dtn::Dictionary Class Reference

Simple data structure to handle a dictionary data structure, as specified by the bundle protocol, i.e. More...

#include <Dictionary.h>

List of all members.

Public Member Functions

 Dictionary ()
 Dictionary (const oasys::Builder &)
virtual ~Dictionary ()
virtual void serialize (oasys::SerializeAction *a)
void add_str (const std::string &str)
 Add the given string to the dictionary if it doesn't already exist.
void add_eid (const EndpointID &eid)
 Add the scheme and ssp of the given endpoint id to the dictionary.
bool get_offset (const std::string &str, u_int32_t *offset)
 Look up the given string in the dictionary, returning true and assigning the offset if found.
bool get_offset (const std::string &str, u_int64_t *offset)
bool get_offsets (const EndpointID &eid, u_int32_t *scheme_offset, u_int32_t *ssp_offset)
 Look up the given eid in the dictionary, returning true and assigning the offsets if found.
bool get_offsets (const EndpointID &eid, u_int64_t *scheme_offset, u_int64_t *ssp_offset)
bool extract_eid (EndpointID *eid, u_int32_t scheme_offset, u_int32_t ssp_offset)
 Create an eid from the dictionary, given the offsets.
bool extract_eid (EndpointID *eid, u_int64_t scheme_offset, u_int64_t ssp_offset)
u_int32_t length () const
 Accessors.
const u_char * dict () const
 Accessors.
void set_dict (const u_char *dict, u_int32_t length)
 Accessors.

Protected Attributes

u_char * dict_
 Dictionary buffer.
u_int32_t dict_length_
 Length of the dictionary buffer.
u_int32_t length_
 Length of the filled-in portion.


Detailed Description

Simple data structure to handle a dictionary data structure, as specified by the bundle protocol, i.e.

a sequence of null terminated strings.

Definition at line 30 of file bundling/Dictionary.h.


Constructor & Destructor Documentation

dtn::Dictionary::Dictionary (  ) 

Definition at line 27 of file bundling/Dictionary.cc.

dtn::Dictionary::Dictionary ( const oasys::Builder &   ) 

Definition at line 33 of file bundling/Dictionary.cc.

dtn::Dictionary::~Dictionary (  )  [virtual]

Definition at line 39 of file bundling/Dictionary.cc.

References dict_, dict_length_, and length_.


Member Function Documentation

void dtn::Dictionary::add_eid ( const EndpointID eid  )  [inline]

Add the scheme and ssp of the given endpoint id to the dictionary.

Definition at line 52 of file bundling/Dictionary.h.

References add_str(), dtn::EndpointID::scheme_str(), and dtn::EndpointID::ssp().

Referenced by dtn::BlockProcessor::generate_preamble(), and dtn::PrimaryBlockProcessor::prepare().

void dtn::Dictionary::add_str ( const std::string &  str  ) 

Add the given string to the dictionary if it doesn't already exist.

Definition at line 99 of file bundling/Dictionary.cc.

References dict_, dict_length_, get_offset(), and length_.

Referenced by add_eid().

const u_char* dtn::Dictionary::dict (  )  const [inline]

Accessors.

Definition at line 39 of file bundling/Dictionary.h.

References dict_.

Referenced by dtn::PrimaryBlockProcessor::generate_primary().

bool dtn::Dictionary::extract_eid ( EndpointID eid,
u_int64_t  scheme_offset,
u_int64_t  ssp_offset 
)

Definition at line 178 of file bundling/Dictionary.cc.

References extract_eid().

bool dtn::Dictionary::extract_eid ( EndpointID eid,
u_int32_t  scheme_offset,
u_int32_t  ssp_offset 
)

Create an eid from the dictionary, given the offsets.

Return true upon success.

Definition at line 131 of file bundling/Dictionary.cc.

References dtn::EndpointID::assign(), dtn::EndpointID::c_str(), dict_, dict_length_, dtn::log, log_err_p, dtn::EndpointID::scheme_str(), dtn::EndpointID::ssp(), and dtn::EndpointID::valid().

Referenced by dtn::BlockProcessor::consume_preamble(), and extract_eid().

bool dtn::Dictionary::get_offset ( const std::string &  str,
u_int64_t *  offset 
)

Definition at line 80 of file bundling/Dictionary.cc.

References ASSERT, dict_, len, and length_.

bool dtn::Dictionary::get_offset ( const std::string &  str,
u_int32_t *  offset 
)

Look up the given string in the dictionary, returning true and assigning the offset if found.

Definition at line 61 of file bundling/Dictionary.cc.

References ASSERT, dict_, len, and length_.

Referenced by add_str(), and get_offsets().

bool dtn::Dictionary::get_offsets ( const EndpointID eid,
u_int64_t *  scheme_offset,
u_int64_t *  ssp_offset 
) [inline]

bool dtn::Dictionary::get_offsets ( const EndpointID eid,
u_int32_t *  scheme_offset,
u_int32_t *  ssp_offset 
) [inline]

Look up the given eid in the dictionary, returning true and assigning the offsets if found.

Definition at line 70 of file bundling/Dictionary.h.

References get_offset(), dtn::EndpointID::scheme_str(), and dtn::EndpointID::ssp().

Referenced by dtn::BlockProcessor::generate_preamble(), and dtn::PrimaryBlockProcessor::get_primary_len().

u_int32_t dtn::Dictionary::length (  )  const [inline]

void dtn::Dictionary::serialize ( oasys::SerializeAction *  a  )  [virtual]

Definition at line 122 of file bundling/Dictionary.cc.

References dict_, dict_length_, and length_.

void dtn::Dictionary::set_dict ( const u_char *  dict,
u_int32_t  length 
)

Accessors.

Definition at line 51 of file bundling/Dictionary.cc.

References ASSERT, dict_, dict_length_, and length_.


Member Data Documentation

u_char* dtn::Dictionary::dict_ [protected]

Dictionary buffer.

Definition at line 99 of file bundling/Dictionary.h.

Referenced by add_str(), dict(), extract_eid(), get_offset(), serialize(), set_dict(), and ~Dictionary().

u_int32_t dtn::Dictionary::dict_length_ [protected]

Length of the dictionary buffer.

Definition at line 100 of file bundling/Dictionary.h.

Referenced by add_str(), extract_eid(), serialize(), set_dict(), and ~Dictionary().

u_int32_t dtn::Dictionary::length_ [protected]

Length of the filled-in portion.

Definition at line 101 of file bundling/Dictionary.h.

Referenced by add_str(), get_offset(), length(), serialize(), set_dict(), and ~Dictionary().


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

Generated on Fri Jan 30 09:43:13 2009 for DTN Reference Implementation by  doxygen 1.5.8