DTN::Bundle Class Reference

The basic data element passed between nodes. More...

#include <dtn/Bundle.h>

Inheritance diagram for DTN::Bundle:

Inheritance graph
[legend]

List of all members.

Public Types

enum  {
  kData = 1 << 0, kACK = 1 << 1, kNoACK = 1 << 2, kCustodial = 1 << 3,
  kBcast = 1 << 4
}
 Enumeration defining types of bundles. More...
typedef unsigned char BundleType
 Flags defining the type and handling for the bundle.

Public Member Functions

 Bundle (uint32_t seq, const ByteString &src, const struct timeval &creat, const struct timeval &expir, BundleType t=kData, const ByteString &app=ByteString())
 Basic constructor, without destination or payload specified.
 Bundle (const Bundle &aOther)
 Copy constructor.
 Bundle (uint32_t seq, const ByteString &src, const ByteString &dest, const struct timeval &creat, const struct timeval &expir, BundleType t=kData, const ByteString &app=ByteString())
 Constructor without payload.
 Bundle (uint32_t seq, const ByteString &src, const ByteString &dest, const ByteString &data, const struct timeval &creat, const struct timeval &expir, BundleType t=kData, const ByteString &app=ByteString())
 Fully specified constructor.
virtual ~Bundle ()
 Destructor.
virtual Bundleclone () const
 
Returns:
a copy of the bundle

virtual unsigned int size () const
 
Returns:
the total size (in bytes) of the bundle

uint32_t seqNum () const
 
Returns:
the sequence number of the bundle at its source

const ByteString & source () const
 
Returns:
constant reference to the bundle's source

const ByteString & destination () const
 
Returns:
constant reference to the bundle's destination

const ByteString & custodian () const
 
Returns:
constant reference to the bundle's custodian

const ByteString & send () const
 
Returns:
constant reference to the bundle's sender

const ByteString & recv () const
 
Returns:
constant reference to the bundle's receiver

const ByteString & payload () const
 
Returns:
constant reference to the bundle's payload

struct timeval & created () const
 
Returns:
constant reference to the bundle's creation time

struct timeval & expiry () const
 
Returns:
constant reference to the bundle's expiration time

BundleType type () const
 
Returns:
the type of bundle

const ByteString & app () const
 
Returns:
the application type of the bundle

uint32_t hopCount () const
 
Returns:
the number of hops the bundle has taken

ByteString & destination ()
 
Returns:
modifiable reference to the bundle's destination

ByteString & custodian ()
 
Returns:
modifiable reference to the bundle's custodian

ByteString & send ()
 
Returns:
modifiable reference to the bundle's sender

ByteString & recv ()
 
Returns:
modifiable reference to the bundle's receiver

ByteString & payload ()
 
Returns:
modifiable reference to the bundle's payload

struct timeval & created ()
 
Returns:
modifiable reference to the bundle's creation time

struct timeval & expiry ()
 
Returns:
modifiable reference to the bundle's expiration time

BundleTypetype ()
 
Returns:
modifiable reference to the bundle's type flags

virtual bool expired () const
 
Returns:
whether the bundle has expired

void incrHop ()
 Increment the hop count.


Detailed Description

The basic data element passed between nodes.

This class holds the DTN routing and forwarding information, as well as the serialized data to be forwarded. A wrapper will need to translate this into socket and data information, a raw packet, a simulator event, etc.

Note:
For now, we store two pieces of information: the serialized data (i.e., what we would write to a socket) as a ByteString and a ByteString recording the destination. For IPv4, the latter would be a 32-bit address and a 16-bit port number.
Todo:
This should eventually use DTN::Header.

Definition at line 59 of file Bundle.h.


Member Enumeration Documentation

anonymous enum

Enumeration defining types of bundles.

Enumerator:
kData  This bundle contains data.
kACK  This bundle is an acknowledgement.
kNoACK  This bundle should not be ACKed.
kCustodial  This bundle wants custody transfer.
kBcast  This is a broadcast bundle.

Definition at line 66 of file Bundle.h.


Constructor & Destructor Documentation

Bundle::Bundle ( uint32_t  seq,
const ByteString &  src,
const struct timeval &  creat,
const struct timeval &  expir,
BundleType  t = kData,
const ByteString &  app = ByteString() 
)

Basic constructor, without destination or payload specified.

Parameters:
seq The sequence number of the bundle at src
src ByteString representation of the bundle's source
creat Creation time
expir Expiration time
t The type of bundle
app The application identifier for this bundle

Definition at line 36 of file Bundle.cc.

Referenced by MockBundle::MockBundle().

Bundle::Bundle ( const Bundle aOther  ) 

Copy constructor.

Parameters:
aOther A Bundle to copy

Definition at line 57 of file Bundle.cc.

References m_created, and m_expiry.

Bundle::Bundle ( uint32_t  seq,
const ByteString &  src,
const ByteString &  dest,
const struct timeval &  creat,
const struct timeval &  expir,
BundleType  t = kData,
const ByteString &  app = ByteString() 
)

Constructor without payload.

Parameters:
seq The sequence number of the bundle at src
src ByteString representation of the bundle's source
dest ByteString representation of the bundle's destination
creat Creation time
expir Creation time
t The type of bundle
app The application identifier for this bundle

Definition at line 75 of file Bundle.cc.

Bundle::Bundle ( uint32_t  seq,
const ByteString &  src,
const ByteString &  dest,
const ByteString &  data,
const struct timeval &  creat,
const struct timeval &  expir,
BundleType  t = kData,
const ByteString &  app = ByteString() 
)

Fully specified constructor.

Parameters:
seq The sequence number of the bundle at src
src ByteString representation of the bundle's source
dest ByteString representation of the bundle's destination
data ByteString serialization of the bundle's payload
creat Creation time
expir Creation time
t The type of bundle
app The application identifier for this bundle

Definition at line 98 of file Bundle.cc.


The documentation for this class was generated from the following files:
Generated on Mon Mar 24 11:15:48 2008 for Pydtn Simulator by  doxygen 1.5.4