#include <Bundle.h>
Public Member Functions | |
| Bundle (NetworkFrame *frame) | |
| Bundle (NetworkFrame *frame, const list< Block * > blocks) | |
| Bundle (const Bundle &b) | |
| virtual | ~Bundle () |
| bool | operator== (const Bundle &other) const |
| bool | operator!= (const Bundle &other) const |
| void | setFragment (bool value) |
| unsigned char * | getData () const |
| unsigned int | getLength () const |
| u_int64_t | getInteger (const BUNDLE_FIELDS field) const throw (InvalidFieldException, FieldDoesNotExist) |
| void | setInteger (const BUNDLE_FIELDS field, const u_int64_t value) throw (InvalidFieldException, FieldDoesNotExist) |
| string | getDestination () const |
| void | setDestination (string destination) |
| string | getSource () const |
| void | setSource (string source) |
| string | getReportTo () const |
| void | setReportTo (string reportto) |
| string | getCustodian () const |
| void | setCustodian (string custodian) |
| PrimaryFlags | getPrimaryFlags () const |
| void | setPrimaryFlags (PrimaryFlags &flags) |
| const list< Block * > & | getBlocks () const |
| void | appendBlock (Block *block) |
| void | insertBlock (Block *block) |
| void | removeBlock (Block *block) |
| const NetworkFrame & | getFrame () const |
| void | updateBlockLength () |
| bool | isExpired () const |
| string | toString () const |
| PayloadBlock * | getPayloadBlock () const |
| list< Block * > | getBlocks (const unsigned char type) const |
Private Member Functions | |
| int | getPosition (BUNDLE_FIELDS field) throw (FieldDoesNotExist, InvalidBundleData) |
| Dictionary | getDictionary () const |
| void | commitDictionary (const Dictionary &dict) |
Private Attributes | |
| NetworkFrame * | m_frame |
| list< Block * > | m_blocks |
| dtn::data::Bundle::Bundle | ( | NetworkFrame * | frame | ) |
creates a new bundle object with a given NetworkFrame
| [in] | frame | A NetworkFrame Object with parsed data. |
| dtn::data::Bundle::Bundle | ( | NetworkFrame * | frame, | |
| const list< Block * > | blocks | |||
| ) |
creates a new bundle object with a given NetworkFrame and Blocks
| [in] | frame | A NetworkFrame Object with parsed data. |
| [in] | blocks | A list of block references which belongs to this bundle. |
| dtn::data::Bundle::Bundle | ( | const Bundle & | b | ) |
| dtn::data::Bundle::~Bundle | ( | ) | [virtual] |
| bool dtn::data::Bundle::operator== | ( | const Bundle & | other | ) | const |
Compare a Bundle object to another one. A bundle is equal to another if the source, creation timestamp and the sequence number is equal.
| [in] | other | The bundle to compare with this bundle. |
References dtn::data::CREATION_TIMESTAMP, dtn::data::CREATION_TIMESTAMP_SEQUENCE, getInteger(), and getSource().
| bool dtn::data::Bundle::operator!= | ( | const Bundle & | other | ) | const |
Compare a Bundle object to another one.
| [in] | other | The bundle to compare with this bundle. |
References dtn::data::CREATION_TIMESTAMP, dtn::data::CREATION_TIMESTAMP_SEQUENCE, getInteger(), and getSource().
| void dtn::data::Bundle::setFragment | ( | bool | value | ) |
Mark a bundle as containing fragmented payload blocks. The required fields FRAGMENTATION_OFFSET and APPLICATION_DATA_LENGTH will be added or removed if necessary.
| [in] | value | true, if this bundle should marked as containing fragmented payload blocks. |
References dtn::data::NetworkFrame::append(), dtn::data::APPLICATION_DATA_LENGTH, dtn::data::FRAGMENTATION_OFFSET, getPrimaryFlags(), dtn::data::PrimaryFlags::isFragment(), m_frame, dtn::data::NetworkFrame::remove(), dtn::data::PrimaryFlags::setFragment(), setPrimaryFlags(), and updateBlockLength().
Referenced by dtn::data::BundleFactory::cut(), dtn::data::BundleFactory::merge(), and dtn::data::BundleFactory::slice().
| unsigned char * dtn::data::Bundle::getData | ( | ) | const |
Get a data-array with a copy of the hole bundle with all trailing blocks. You need to free this array after use!
References dtn::data::NetworkFrame::getData(), getLength(), dtn::data::NetworkFrame::getSize(), m_blocks, and m_frame.
Referenced by dtn::core::UDPConvergenceLayer::transmit(), and dtn::core::TCPConvergenceLayer::transmit().
| unsigned int dtn::data::Bundle::getLength | ( | ) | const |
Get the length of the hole bundle with all trailing blocks
References dtn::data::NetworkFrame::getSize(), m_blocks, and m_frame.
Referenced by dtn::core::SimpleBundleStorage::deleteDeprecated(), getData(), dtn::core::SimpleBundleStorage::getSchedule(), dtn::data::BundleFactory::slice(), dtn::core::SimpleBundleStorage::store(), dtn::core::UDPConvergenceLayer::transmit(), and dtn::core::TCPConvergenceLayer::transmit().
| u_int64_t dtn::data::Bundle::getInteger | ( | const BUNDLE_FIELDS | field | ) | const throw (InvalidFieldException, FieldDoesNotExist) |
Get a numeric value of a specific field.
Exceptions: InvalidFieldException The field doesn't contain a numeric value. FieldDoesNotExists The field doesn't exists. InvalidBundleData The data of the bundle is invalid. SDNVDecodeFailed Decoding of the SDNV failed.
| [in] | field | A field out of the enumeration BUNDLE_FIELDS |
References dtn::data::DICTIONARY_BYTEARRAY, dtn::data::NetworkFrame::getSDNV(), m_frame, and dtn::data::VERSION.
Referenced by dtn::data::BundleFactory::compareFragments(), dtn::data::BundleFactory::cut(), dtn::core::SimpleBundleStorage::deleteDeprecated(), getCustodian(), getDestination(), getPrimaryFlags(), getReportTo(), getSource(), isExpired(), dtn::data::StatusReportBlock::match(), dtn::data::CustodySignalBlock::match(), dtn::data::BundleFactory::merge(), operator!=(), operator==(), dtn::data::StatusReportBlock::setMatch(), dtn::data::CustodySignalBlock::setMatch(), dtn::data::BundleFactory::slice(), dtn::core::SimpleBundleStorage::store(), dtn::core::SimpleBundleStorage::storeFragment(), toString(), and updateBlockLength().
| void dtn::data::Bundle::setInteger | ( | const BUNDLE_FIELDS | field, | |
| const u_int64_t | value | |||
| ) | throw (InvalidFieldException, FieldDoesNotExist) |
Set a numeric value of a specific field.
| [in] | field | A field out of the enumeration BUNDLE_FIELD |
| [in] | value | The numeric value to set in the field. |
References dtn::data::DICTIONARY_BYTEARRAY, m_frame, dtn::data::NetworkFrame::set(), updateBlockLength(), and dtn::data::VERSION.
Referenced by dtn::data::BundleFactory::cut(), dtn::daemon::TestApplication::reportIt(), setPrimaryFlags(), dtn::data::BundleFactory::slice(), emma::MeasurementWorker::tick(), and emma::EmmaConvergenceLayer::yell().
| string dtn::data::Bundle::getDestination | ( | ) | const |
Get the destination EID of the bundle.
References dtn::data::DESTINATION_SCHEME, dtn::data::DESTINATION_SSP, dtn::data::Dictionary::get(), getDictionary(), and getInteger().
Referenced by dtn::core::BundleCore::deliver(), dtn::core::StaticBundleRouter::getSchedule(), dtn::core::SimpleBundleStorage::getSchedule(), dtn::core::BundleRouter::getSchedule(), dtn::core::BundleRouter::isLocal(), dtn::core::StaticRoute::match(), dtn::core::BundleRouter::raiseEvent(), emma::EmmaConvergenceLayer::received(), and toString().
| void dtn::data::Bundle::setDestination | ( | string | destination | ) |
Set the destination EID of the bundle.
| [in] | destination | The destination EID to set. |
References dtn::data::Dictionary::add(), commitDictionary(), dtn::data::DESTINATION_SCHEME, dtn::data::DESTINATION_SSP, getDictionary(), m_frame, and dtn::data::NetworkFrame::set().
Referenced by dtn::core::CustodyManager::acceptCustody(), dtn::daemon::EchoWorker::callbackBundleReceived(), dtn::core::BundleCore::createCustodySignal(), dtn::core::BundleCore::createStatusReport(), dtn::core::CustodyManager::rejectCustody(), dtn::daemon::TestApplication::reportIt(), emma::MeasurementWorker::tick(), and emma::EmmaConvergenceLayer::yell().
| string dtn::data::Bundle::getSource | ( | ) | const |
Get the source EID of the bundle.
References dtn::data::Dictionary::get(), getDictionary(), getInteger(), dtn::data::SOURCE_SCHEME, and dtn::data::SOURCE_SSP.
Referenced by dtn::daemon::EchoWorker::callbackBundleReceived(), dtn::data::StatusReportBlock::match(), dtn::data::CustodySignalBlock::match(), dtn::data::BundleFactory::merge(), operator!=(), operator==(), emma::EmmaConvergenceLayer::received(), dtn::data::StatusReportBlock::setMatch(), dtn::data::CustodySignalBlock::setMatch(), and toString().
| void dtn::data::Bundle::setSource | ( | string | source | ) |
Set the source EID of the bundle.
| [in] | source | The source EID to set. |
References dtn::data::Dictionary::add(), commitDictionary(), getDictionary(), m_frame, dtn::data::NetworkFrame::set(), dtn::data::SOURCE_SCHEME, and dtn::data::SOURCE_SSP.
Referenced by dtn::core::CustodyManager::acceptCustody(), dtn::daemon::EchoWorker::callbackBundleReceived(), dtn::core::BundleCore::createCustodySignal(), dtn::core::BundleCore::createStatusReport(), dtn::core::CustodyManager::rejectCustody(), dtn::daemon::TestApplication::reportIt(), emma::MeasurementWorker::tick(), and emma::EmmaConvergenceLayer::yell().
| string dtn::data::Bundle::getReportTo | ( | ) | const |
Get the reportto EID of the bundle.
References dtn::data::Dictionary::get(), getDictionary(), getInteger(), dtn::data::REPORTTO_SCHEME, and dtn::data::REPORTTO_SSP.
Referenced by dtn::core::BundleCore::createStatusReport().
| void dtn::data::Bundle::setReportTo | ( | string | reportto | ) |
Set the reportto EID of the bundle.
| [in] | reportto | The reportto EID to set. |
References dtn::data::Dictionary::add(), commitDictionary(), getDictionary(), m_frame, dtn::data::REPORTTO_SCHEME, dtn::data::REPORTTO_SSP, and dtn::data::NetworkFrame::set().
Referenced by dtn::daemon::TestApplication::reportIt().
| string dtn::data::Bundle::getCustodian | ( | ) | const |
Get the custodian EID of the bundle.
References dtn::data::CUSTODIAN_SCHEME, dtn::data::CUSTODIAN_SSP, dtn::data::Dictionary::get(), getDictionary(), and getInteger().
Referenced by dtn::core::CustodyManager::acceptCustody(), dtn::core::BundleCore::createCustodySignal(), dtn::core::AbstractBundleStorage::raiseEvent(), dtn::core::CustodyManager::rejectCustody(), dtn::core::SimpleBundleStorage::storeFragment(), and dtn::core::BundleCore::transmit().
| void dtn::data::Bundle::setCustodian | ( | string | custodian | ) |
Set the custodian EID of the bundle.
| [in] | custodian | The custodian EID to set. |
References dtn::data::Dictionary::add(), commitDictionary(), dtn::data::CUSTODIAN_SCHEME, dtn::data::CUSTODIAN_SSP, getDictionary(), m_frame, and dtn::data::NetworkFrame::set().
Referenced by dtn::core::AbstractBundleStorage::raiseEvent(), dtn::core::SimpleBundleStorage::storeFragment(), and dtn::core::BundleCore::transmit().
| PrimaryFlags dtn::data::Bundle::getPrimaryFlags | ( | ) | const |
Get the primary flags of this bundle encapsulated in a PrimaryFlags object.
References getInteger(), and dtn::data::PROCFLAGS.
Referenced by dtn::core::CustodyManager::acceptCustody(), appendBlock(), dtn::data::BundleFactory::cut(), dtn::core::BundleCore::deliver(), insertBlock(), dtn::data::StatusReportBlock::match(), dtn::data::CustodySignalBlock::match(), dtn::data::BundleFactory::merge(), dtn::core::EventDebugger::raiseEvent(), dtn::core::BundleCore::raiseEvent(), dtn::core::AbstractBundleStorage::raiseEvent(), dtn::core::CustodyManager::rejectCustody(), dtn::daemon::TestApplication::reportIt(), setFragment(), dtn::data::StatusReportBlock::setMatch(), dtn::data::CustodySignalBlock::setMatch(), dtn::data::BundleFactory::slice(), dtn::core::SimpleBundleStorage::storeFragment(), emma::MeasurementWorker::tick(), dtn::core::BundleCore::transmit(), and emma::EmmaConvergenceLayer::yell().
| void dtn::data::Bundle::setPrimaryFlags | ( | PrimaryFlags & | flags | ) |
Set the primary flags of this bundle.
| [in] | flags | PrimaryFlags objects containing the flags to set. |
References dtn::data::ProcessingFlags::getValue(), dtn::data::PROCFLAGS, and setInteger().
Referenced by appendBlock(), insertBlock(), dtn::daemon::TestApplication::reportIt(), setFragment(), emma::MeasurementWorker::tick(), and emma::EmmaConvergenceLayer::yell().
| const list< Block * > & dtn::data::Bundle::getBlocks | ( | ) | const |
Get a list of all blocks of this bundle.
References m_blocks.
Referenced by emma::EmmaConvergenceLayer::received().
| void dtn::data::Bundle::appendBlock | ( | Block * | block | ) |
Append a new block at the end of this bundle.
| [in] | block | The block to append. |
References dtn::data::Block::getBlockFlags(), getPrimaryFlags(), dtn::data::LAST_BLOCK, m_blocks, dtn::data::PrimaryFlags::setAdmRecord(), dtn::data::Block::setBlockFlags(), dtn::data::ProcessingFlags::setFlag(), and setPrimaryFlags().
Referenced by dtn::core::CustodyManager::acceptCustody(), dtn::daemon::EchoWorker::callbackBundleReceived(), dtn::core::BundleCore::createCustodySignal(), dtn::core::BundleCore::createStatusReport(), dtn::data::BundleFactory::cut(), dtn::data::BundleFactory::merge(), dtn::core::CustodyManager::rejectCustody(), dtn::daemon::TestApplication::reportIt(), dtn::data::BundleFactory::slice(), emma::MeasurementWorker::tick(), and emma::EmmaConvergenceLayer::yell().
| void dtn::data::Bundle::insertBlock | ( | Block * | block | ) |
Insert a new block in front of the first block of this bundle.
| [in] | block | The block to insert. |
References getPrimaryFlags(), m_blocks, dtn::data::PrimaryFlags::setAdmRecord(), and setPrimaryFlags().
| void dtn::data::Bundle::removeBlock | ( | Block * | block | ) |
Remove a specific block of the bundle.
| [in] | block | The pointer to the bundle to remove. |
References dtn::data::Block::getBlockFlags(), dtn::data::LAST_BLOCK, m_blocks, dtn::data::Block::setBlockFlags(), and dtn::data::ProcessingFlags::setFlag().
| const NetworkFrame & dtn::data::Bundle::getFrame | ( | ) | const |
Get the NetworkFrame of this bundle containing the primary block.
References m_frame.
Referenced by dtn::data::BundleFactory::cut(), dtn::data::BundleFactory::merge(), and dtn::data::BundleFactory::slice().
| void dtn::data::Bundle::updateBlockLength | ( | ) |
Updates the BLOCKLENGTH field. This function should called after a set()-function.
References dtn::data::APPLICATION_DATA_LENGTH, dtn::data::BLOCKLENGTH, dtn::data::DESTINATION_SCHEME, dtn::data::DICTIONARY_BYTEARRAY, getInteger(), dtn::data::NetworkFrame::getSize(), dtn::data::PrimaryFlags::isFragment(), m_frame, dtn::data::PROCFLAGS, and dtn::data::NetworkFrame::set().
Referenced by commitDictionary(), dtn::data::BundleFactory::newBundle(), setFragment(), and setInteger().
| bool dtn::data::Bundle::isExpired | ( | ) | const |
Determine if a bundle is expired. return true, if the bundle is expired, else false.
References dtn::data::CREATION_TIMESTAMP, dtn::data::BundleFactory::getDTNTime(), getInteger(), and dtn::data::LIFETIME.
Referenced by dtn::core::SimpleBundleStorage::deleteDeprecated(), and dtn::core::BundleRouter::getSchedule().
| string dtn::data::Bundle::toString | ( | ) | const |
Create a short string to represent this bundle.
References dtn::data::CREATION_TIMESTAMP, dtn::data::CREATION_TIMESTAMP_SEQUENCE, getDestination(), getInteger(), and getSource().
Referenced by dtn::daemon::Debugger::callbackBundleReceived(), and dtn::core::EventDebugger::raiseEvent().
| PayloadBlock * dtn::data::Bundle::getPayloadBlock | ( | ) | const |
Search and return the PayloadBlock of a bundle.
References m_blocks.
Referenced by dtn::daemon::EchoWorker::callbackBundleReceived(), dtn::data::BundleFactory::cut(), dtn::data::BundleFactory::cutAt(), dtn::core::BundleCore::deliver(), dtn::data::BundleFactory::merge(), and dtn::data::BundleFactory::slice().
| list< Block * > dtn::data::Bundle::getBlocks | ( | const unsigned char | type | ) | const |
Get a list of block with a specific block type
References dtn::data::Block::getType(), and m_blocks.
| int dtn::data::Bundle::getPosition | ( | BUNDLE_FIELDS | field | ) | throw (FieldDoesNotExist, InvalidBundleData) [private] |
Get the position of a field in the raw data. The position is the number of bytes from begin of the raw data.
Exceptions: FieldDoesNotExists Field doesn't exists InvalidBundleData The bundle data is invalid.
| [in] | field | A field out of the enumeration BUNDLE_FIELDS |
References dtn::data::NetworkFrame::getPosition(), and m_frame.
| Dictionary dtn::data::Bundle::getDictionary | ( | ) | const [private] |
References dtn::data::DICTIONARY_BYTEARRAY, dtn::data::DICTIONARY_LENGTH, dtn::data::NetworkFrame::get(), dtn::data::NetworkFrame::getSDNV(), m_frame, and dtn::data::Dictionary::read().
Referenced by getCustodian(), getDestination(), getReportTo(), getSource(), setCustodian(), setDestination(), setReportTo(), and setSource().
| void dtn::data::Bundle::commitDictionary | ( | const Dictionary & | dict | ) | [private] |
References dtn::data::NetworkFrame::changeSize(), dtn::data::DICTIONARY_BYTEARRAY, dtn::data::DICTIONARY_LENGTH, dtn::data::NetworkFrame::get(), dtn::data::Dictionary::getLength(), m_frame, dtn::data::NetworkFrame::set(), updateBlockLength(), and dtn::data::Dictionary::write().
Referenced by setCustodian(), setDestination(), setReportTo(), and setSource().
NetworkFrame* dtn::data::Bundle::m_frame [private] |
list<Block*> dtn::data::Bundle::m_blocks [private] |
Referenced by appendBlock(), Bundle(), getBlocks(), getData(), getLength(), getPayloadBlock(), insertBlock(), removeBlock(), and ~Bundle().
1.5.6