IBR-DTNSuite  0.8
dtn::api::Bundle Class Reference

#include <Bundle.h>

Inheritance diagram for dtn::api::Bundle:
Collaboration diagram for dtn::api::Bundle:

List of all members.

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)

Detailed Description

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.

Definition at line 26 of file Bundle.h.


Member Enumeration Documentation

Define the Bundle Priorities PRIO_LOW low priority for this bundle PRIO_MEDIUM medium priority for this bundle PRIO_HIGH high priority for this bundle

Enumerator:
PRIO_LOW 
PRIO_MEDIUM 
PRIO_HIGH 

Definition at line 38 of file Bundle.h.


Constructor & Destructor Documentation

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().

Here is the call graph for this function:

dtn::api::Bundle::Bundle ( const dtn::data::EID destination)

Constructor for a bundle object

Parameters:
destinationdefines the destination of this bundle.

Definition at line 27 of file Bundle.cpp.

References _b, dtn::data::PrimaryBlock::_source, PRIO_MEDIUM, setDestination(), and setPriority().

Here is the call graph for this function:

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.

Parameters:
bA bundle to copy into this basic bundle.

Definition at line 22 of file Bundle.cpp.


Member Function Documentation

This method returns the custodian of this bundle.

Returns:
The custody EID 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.

Returns:
A reference to the payload block of this bundle.

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().

Here is the call graph for this function:

This method returns the destination of this bundle.

Returns:
The destination EID 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

Returns:
The lifetime of the bundle in seconds.

Definition at line 48 of file Bundle.cpp.

References _b, and dtn::data::PrimaryBlock::_lifetime.

Referenced by main().

Returns the priority for this bundle.

Returns:
The priority of the 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.

Here is the call graph for this function:

This method returns the report-to EID of this bundle.

Returns:
The report-to EID of this bundle.

Definition at line 156 of file Bundle.cpp.

References _b, and dtn::data::PrimaryBlock::_reportto.

This method returns the source of this bundle.

Returns:
The source EID of this bundle.

Definition at line 166 of file Bundle.cpp.

References _b, and dtn::data::PrimaryBlock::_source.

Referenced by main().

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).

Parameters:
otherA bundle to compare.
Returns:
True, if the given bundle is smaller (e.g. timestamp older) as ourself.

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).

Parameters:
otherA bundle to compare.
Returns:
True, if the given bundle is greater (e.g. timestamp newer) as ourself.

Definition at line 191 of file Bundle.cpp.

References _b.

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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.

Parameters:
singeltonSet 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().

Here is the call graph for this function:

void dtn::api::Bundle::setLifetime ( unsigned int  lifetime)

Set the lifetime of a bundle.

Parameters:
lifetimeThe 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.

Parameters:
pThe 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().

Here is the call graph for this function:

Sets the report-to EID of this bundle. All requested reports are delivered to this EID.

Parameters:
eidThe 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.

Parameters:
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class APIClient [friend]

Definition at line 29 of file Bundle.h.

friend class Client [friend]

Definition at line 28 of file Bundle.h.

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.

Parameters:
streamA standard output stream to serialize the bundle into.
bThe bundle to serialize.
Returns:
The same output stream reference as the "stream" parameter.

Definition at line 158 of file Bundle.h.

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.

Parameters:
streamA standard input stream to get the bundle from.
bA bundle object as container for the deserialized data.
Returns:
The same output stream reference as the "stream" parameter.

Definition at line 180 of file Bundle.h.


Member Data Documentation


The documentation for this class was generated from the following files: