IBR-DTNSuite
0.8
|
#include <Bundle.h>
Public Types | |
enum | BUNDLE_PRIORITY { PRIO_LOW = 0, PRIO_MEDIUM = 1, PRIO_HIGH = 2 } |
Public Member Functions | |
Bundle () | |
Bundle (const dtn::data::EID &destination) | |
virtual | ~Bundle () |
void | setSingleton (bool val) |
void | setLifetime (unsigned int lifetime) |
unsigned int | getLifetime () const |
time_t | getTimestamp () const |
void | requestDeliveredReport () |
void | requestForwardedReport () |
void | requestDeletedReport () |
void | requestReceptionReport () |
void | requestCustodyTransfer () |
void | requestEncryption () |
void | requestSigned () |
void | requestCompression () |
bool | statusVerified () |
void | setPriority (BUNDLE_PRIORITY p) |
BUNDLE_PRIORITY | getPriority () const |
ibrcommon::BLOB::Reference | getData () throw (dtn::MissingObjectException) |
void | setDestination (const dtn::data::EID &eid, const bool singleton=true) |
void | setReportTo (const dtn::data::EID &eid) |
dtn::data::EID | getDestination () const |
dtn::data::EID | getSource () const |
dtn::data::EID | getReportTo () const |
dtn::data::EID | getCustodian () const |
bool | operator< (const Bundle &other) const |
bool | operator> (const Bundle &other) const |
Protected Member Functions | |
Bundle (const dtn::data::Bundle &b) | |
Protected Attributes | |
dtn::data::Bundle | _b |
Friends | |
class | Client |
class | APIClient |
std::ostream & | operator<< (std::ostream &stream, const dtn::api::Bundle &b) |
std::istream & | operator>> (std::istream &stream, dtn::api::Bundle &b) |
This is the basic bundle object as part of the API. An application should use this or derived objects to construct bundles for transmission to a bundle daemon.
Constructor for a bundle object without a destination
Definition at line 16 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::_source, PRIO_MEDIUM, and setPriority().
dtn::api::Bundle::Bundle | ( | const dtn::data::EID & | destination | ) |
Constructor for a bundle object
destination | defines the destination of this bundle. |
Definition at line 27 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::_source, PRIO_MEDIUM, setDestination(), and setPriority().
dtn::api::Bundle::~Bundle | ( | ) | [virtual] |
Destructor
Definition at line 34 of file Bundle.cpp.
dtn::api::Bundle::Bundle | ( | const dtn::data::Bundle & | b | ) | [protected] |
Constructor for a bundle object. This protected because this method should only used by derived classes.
b | A bundle to copy into this basic bundle. |
Definition at line 22 of file Bundle.cpp.
dtn::data::EID dtn::api::Bundle::getCustodian | ( | ) | const |
This method returns the custodian of this bundle.
Definition at line 171 of file Bundle.cpp.
References _b, and dtn::data::PrimaryBlock::_custodian.
With this method the payload of the bundle can be accessed as a BLOB reference object. If no payload block is attached to this bundle an MissingObjectException is thrown.
Definition at line 176 of file Bundle.cpp.
References _b, dtn::data::PayloadBlock::getBLOB(), and dtn::data::Bundle::getBlock().
Referenced by BundleStreamBuf::__underflow(), and main().
This method returns the destination of this bundle.
Definition at line 161 of file Bundle.cpp.
References _b, and dtn::data::PrimaryBlock::_destination.
unsigned int dtn::api::Bundle::getLifetime | ( | ) | const |
Returns the lifetime of a bundle
Definition at line 48 of file Bundle.cpp.
References _b, and dtn::data::PrimaryBlock::_lifetime.
Referenced by main().
Returns the priority for this bundle.
Definition at line 104 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::get(), PRIO_HIGH, PRIO_LOW, PRIO_MEDIUM, dtn::data::PrimaryBlock::PRIORITY_BIT1, and dtn::data::PrimaryBlock::PRIORITY_BIT2.
dtn::data::EID dtn::api::Bundle::getReportTo | ( | ) | const |
This method returns the report-to EID of this bundle.
Definition at line 156 of file Bundle.cpp.
References _b, and dtn::data::PrimaryBlock::_reportto.
dtn::data::EID dtn::api::Bundle::getSource | ( | ) | const |
This method returns the source of this bundle.
Definition at line 166 of file Bundle.cpp.
References _b, and dtn::data::PrimaryBlock::_source.
Referenced by main().
time_t dtn::api::Bundle::getTimestamp | ( | ) | const |
Returns the timestamp of the bundle.
Definition at line 53 of file Bundle.cpp.
References _b, and dtn::data::PrimaryBlock::_timestamp.
bool dtn::api::Bundle::operator< | ( | const Bundle & | other | ) | const |
Compares a bundle to another bundle to get an ordering of bundles. The ordering if completely based on the primary block of the bundle and compares source, timestamp, sequencenumber and fragment offset (if available).
other | A bundle to compare. |
Definition at line 186 of file Bundle.cpp.
References _b.
bool dtn::api::Bundle::operator> | ( | const Bundle & | other | ) | const |
Compares a bundle to another bundle to get an ordering of bundles. The ordering if completely based on the primary block of the bundle and compares source, timestamp, sequencenumber and fragment offset (if available).
other | A bundle to compare. |
Definition at line 191 of file Bundle.cpp.
References _b.
void dtn::api::Bundle::requestCompression | ( | ) |
Set the request compression flag.
Definition at line 94 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::IBRDTN_REQUEST_COMPRESSION, and dtn::data::PrimaryBlock::set().
Referenced by main().
Set the request custody transfer flag.
Definition at line 78 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::_custodian, dtn::data::PrimaryBlock::CUSTODY_REQUESTED, and dtn::data::PrimaryBlock::set().
Referenced by main().
Set the request deleted report bit in the bundle processing flags. This triggers an deleted report, if the bundle is deleted on a bundle daemon.
Definition at line 68 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::REQUEST_REPORT_OF_BUNDLE_DELETION, and dtn::data::PrimaryBlock::set().
Set the request delivery report bit in the bundle processing flags. This triggers an delivered report, if the bundle is delivered to an application.
Definition at line 58 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::REQUEST_REPORT_OF_BUNDLE_DELIVERY, and dtn::data::PrimaryBlock::set().
void dtn::api::Bundle::requestEncryption | ( | ) |
Set the request encryption bit in the bundle processing flags. The right after the bundle is transferred to the daemon, it will be encrypted if keys are available.
Definition at line 84 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::DTNSEC_REQUEST_ENCRYPT, and dtn::data::PrimaryBlock::set().
Referenced by main().
Set the request forwarded report bit in the bundle processing flags. This triggers an forwarded report on each sending bundle daemon.
Definition at line 63 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::REQUEST_REPORT_OF_BUNDLE_FORWARDING, and dtn::data::PrimaryBlock::set().
Set the request reception report bit in the bundle processing flags. This triggers an reception report on each receiving bundle daemon.
Definition at line 73 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::REQUEST_REPORT_OF_BUNDLE_RECEPTION, and dtn::data::PrimaryBlock::set().
void dtn::api::Bundle::requestSigned | ( | ) |
Set the request signed bit in the bundle processing flags. The right after the bundle is transferred to the daemon, it will be signed if keys are available.
Definition at line 89 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::DTNSEC_REQUEST_SIGN, and dtn::data::PrimaryBlock::set().
Referenced by main().
void dtn::api::Bundle::setDestination | ( | const dtn::data::EID & | eid, |
const bool | singleton = true |
||
) |
This method set the destination of a bundle. By default a destination of a bundle is a singleton, but it is possible to send one bundle to a set of destinations by unset the destination-is-singleton bit.
singelton | Set this to true, if the destination is a singleton (default). Use false if you use it for multicast. |
Definition at line 141 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::_destination, dtn::data::PrimaryBlock::DESTINATION_IS_SINGLETON, and dtn::data::PrimaryBlock::set().
Referenced by Bundle(), and main().
void dtn::api::Bundle::setLifetime | ( | unsigned int | lifetime | ) |
Set the lifetime of a bundle.
lifetime | The new lifetime of this bundle in seconds. |
Definition at line 43 of file Bundle.cpp.
References _b, and dtn::data::PrimaryBlock::_lifetime.
Referenced by main().
Set the priority for this bundle.
p | The priority of the bundle. |
Definition at line 119 of file Bundle.cpp.
References _b, PRIO_HIGH, PRIO_LOW, PRIO_MEDIUM, dtn::data::PrimaryBlock::PRIORITY_BIT1, dtn::data::PrimaryBlock::PRIORITY_BIT2, and dtn::data::PrimaryBlock::set().
Referenced by Bundle(), and main().
void dtn::api::Bundle::setReportTo | ( | const dtn::data::EID & | eid | ) |
Sets the report-to EID of this bundle. All requested reports are delivered to this EID.
eid | The EID to deliver reports to. |
Definition at line 151 of file Bundle.cpp.
References _b, and dtn::data::PrimaryBlock::_reportto.
void dtn::api::Bundle::setSingleton | ( | bool | val | ) |
Set the destination address as singleton or not.
val |
Definition at line 38 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::DESTINATION_IS_SINGLETON, and dtn::data::PrimaryBlock::set().
Referenced by main().
bool dtn::api::Bundle::statusVerified | ( | ) |
Return the state of the verified bit. This is set, if the daemon has verified the signature of this bundle successfully.
Definition at line 99 of file Bundle.cpp.
References _b, dtn::data::PrimaryBlock::DTNSEC_STATUS_VERIFIED, and dtn::data::PrimaryBlock::get().
std::ostream& operator<< | ( | std::ostream & | stream, |
const dtn::api::Bundle & | b | ||
) | [friend] |
Serialize a bundle object into a any standard output stream. This method is also used to transmit a bundle to a bundle daemon.
stream | A standard output stream to serialize the bundle into. |
b | The bundle to serialize. |
std::istream& operator>> | ( | std::istream & | stream, |
dtn::api::Bundle & | b | ||
) | [friend] |
Deserialize a bundle out of an input stream. This method is also used to received a bundle from a bundle daemon.
stream | A standard input stream to get the bundle from. |
b | A bundle object as container for the deserialized data. |
dtn::data::Bundle dtn::api::Bundle::_b [protected] |
Definition at line 263 of file Bundle.h.
Referenced by dtn::api::BLOBBundle::BLOBBundle(), Bundle(), StreamBundle::clear(), dtn::api::FileBundle::FileBundle(), getCustodian(), getData(), getDestination(), getLifetime(), getPriority(), getReportTo(), StreamBundle::getSequenceNumber(), getSource(), getTimestamp(), dtn::api::APIClient::notify_delivered(), operator<(), operator>(), requestCompression(), requestCustodyTransfer(), requestDeletedReport(), requestDeliveredReport(), requestEncryption(), requestForwardedReport(), requestReceptionReport(), requestSigned(), dtn::api::APIClient::send(), setDestination(), setLifetime(), setPriority(), setReportTo(), setSingleton(), statusVerified(), StreamBundle::StreamBundle(), and dtn::api::StringBundle::StringBundle().