DTN::PayloadHeader Class Reference

DTN header for Bundle payload. More...

#include <dtn/Header.h>

Inheritance diagram for DTN::PayloadHeader:

Inheritance graph
[legend]
Collaboration diagram for DTN::PayloadHeader:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 PayloadHeader ()
 Default constructor.
 PayloadHeader (const ByteString &pld, unsigned char flags=0)
 Payload constructor.
 PayloadHeader (const PayloadHeader &hdr)
 Copy constructor.
virtual ~PayloadHeader ()
 Virtual destructor.
ByteString::size_type offset () const
 The offset in the header at which the application data begins.
ByteString payload () const
 The application data for a Bundle.


Detailed Description

DTN header for Bundle payload.

Actual application data is contained in this header type. The specification states that at most one such header may be included in any bundle.

Definition at line 335 of file Header.h.


Constructor & Destructor Documentation

PayloadHeader::PayloadHeader ( const ByteString &  pld,
unsigned char  flags = 0 
)

Payload constructor.

Parameters:
pld The application data payload for the bundle
flags The header's BundleHeaderFlags
Note:
There exists a default value for flags, which means that this version of the constructor can look identical to the base-class string constructor. However, this version will treat the string as application data. If you have a complete payload header specified as a string, you should use the RegularHeader or Header string constructors, not this constructor.

Definition at line 475 of file Header.cc.

References DTN::RegularHeader::kPayloadHeader, DTN::RegularHeader::length(), DTN::Header::m_data, and DTN::SDNV::val().


Member Function Documentation

ByteString::size_type DTN::PayloadHeader::offset (  )  const [inline]

The offset in the header at which the application data begins.

If the raw header is retrieved via the data() method, the value returned by this method is the first index at which the data resides. This provides an efficient mechanism for retrieving the payload, and should be preferred to the payload() method if data copying is not required.

Returns:
the index in the header at which the payload begins

Definition at line 364 of file Header.h.

ByteString PayloadHeader::payload (  )  const

The application data for a Bundle.

This method makes a copy of the substring beginning at offset(). In fact, it makes two copies, one for the temporary used in the call to substr(), and the other for the returned object. You should use this method only if you actually need a copy of the payload data. Otherwise, use the data() and offset() methods.

Returns:
a copy of the header's payload field

Definition at line 495 of file Header.cc.

References DTN::Header::m_data.


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