prophet::BaseTLV Class Reference

The Prophet I-D (March 2006) dictates five bytecodes for router state exchange messages. More...

#include <BaseTLV.h>

Inheritance diagram for prophet::BaseTLV:

prophet::BundleTLV prophet::HelloTLV prophet::RIBDTLV prophet::RIBTLV prophet::OfferTLV prophet::ResponseTLV

List of all members.

Public Types

enum  prophet_tlv_t {
  UNKNOWN_TLV = 0x00, HELLO_TLV = 0x01, ERROR_TLV = 0x02, RIBD_TLV = 0xA0,
  RIB_TLV = 0xA1, OFFER_TLV = 0XA2, RESPONSE_TLV = 0XA3
}
 Byte codes for TLV types. More...

Public Member Functions

virtual ~BaseTLV ()
 Destructor.
virtual size_t serialize (u_char *bp, size_t len) const =0
 Write out TLV from in-memory representation into provided buffer, using no more than len bytes, returning bytes written.
prophet_tlv_t typecode () const
 Accessors.
u_int8_t flags () const
 Accessors.
u_int16_t length () const
 Accessors.

Static Public Member Functions

static const char * tlv_to_str (prophet_tlv_t tlv)
 Pretty print function for prophet_tlv_t.

Protected Member Functions

 BaseTLV (prophet_tlv_t typecode=UNKNOWN_TLV, u_int8_t flags=0, u_int16_t length=0)
 Constructor is protected to force use of factory.
virtual bool deserialize (const u_char *bp, size_t len)=0
 Read a TLV in from transport and copy its contents into memory.

Protected Attributes

prophet_tlv_t typecode_
 typecode for this TLV
u_int8_t flags_
 TLV-specific flags.
u_int16_t length_
 serialized length of TLV, mutable so it can be assigned by serialize() const


Detailed Description

The Prophet I-D (March 2006) dictates five bytecodes for router state exchange messages.

This implementation introduces a sixth to help differentiate Bundle offers from Bundle responses.

Each Prophet router is a state machine. Each encounter with another router requires an exchange of router state. This begins with a synchronization phase (Hello), followed by an exchange of route tables (Information Exchange).

BaseTLV is the abstract base class from which each concrete class derives its API.

Definition at line 58 of file BaseTLV.h.


Member Enumeration Documentation

Byte codes for TLV types.

Enumerator:
UNKNOWN_TLV 
HELLO_TLV 
ERROR_TLV 
RIBD_TLV 
RIB_TLV 
OFFER_TLV 
RESPONSE_TLV 

Definition at line 64 of file BaseTLV.h.


Constructor & Destructor Documentation

virtual prophet::BaseTLV::~BaseTLV (  )  [inline, virtual]

Destructor.

Definition at line 95 of file BaseTLV.h.

prophet::BaseTLV::BaseTLV ( prophet_tlv_t  typecode = UNKNOWN_TLV,
u_int8_t  flags = 0,
u_int16_t  length = 0 
) [inline, protected]

Constructor is protected to force use of factory.

Definition at line 115 of file BaseTLV.h.


Member Function Documentation

virtual bool prophet::BaseTLV::deserialize ( const u_char *  bp,
size_t  len 
) [protected, pure virtual]

Read a TLV in from transport and copy its contents into memory.

Implemented in prophet::HelloTLV, prophet::OfferTLV, prophet::ResponseTLV, prophet::RIBDTLV, and prophet::RIBTLV.

u_int8_t prophet::BaseTLV::flags (  )  const [inline]

Accessors.

Definition at line 106 of file BaseTLV.h.

References flags_.

Referenced by prophet::BundleTLV::read_bundle_entry().

u_int16_t prophet::BaseTLV::length (  )  const [inline]

Accessors.

Definition at line 107 of file BaseTLV.h.

References length_.

Referenced by prophet::ProphetTLV::add_tlv(), prophet::ProphetTLV::deserialize(), and prophet::ProphetTLV::serialize().

virtual size_t prophet::BaseTLV::serialize ( u_char *  bp,
size_t  len 
) const [pure virtual]

Write out TLV from in-memory representation into provided buffer, using no more than len bytes, returning bytes written.

Implemented in prophet::HelloTLV, prophet::OfferTLV, prophet::ResponseTLV, prophet::RIBDTLV, and prophet::RIBTLV.

Referenced by prophet::ProphetTLV::serialize().

static const char* prophet::BaseTLV::tlv_to_str ( prophet_tlv_t  tlv  )  [inline, static]

Pretty print function for prophet_tlv_t.

Definition at line 78 of file BaseTLV.h.

References ERROR_TLV, HELLO_TLV, OFFER_TLV, RESPONSE_TLV, RIB_TLV, RIBD_TLV, and UNKNOWN_TLV.

prophet_tlv_t prophet::BaseTLV::typecode (  )  const [inline]

Accessors.

Definition at line 105 of file BaseTLV.h.

References typecode_.


Member Data Documentation

u_int8_t prophet::BaseTLV::flags_ [protected]

u_int16_t prophet::BaseTLV::length_ [mutable, protected]


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

Generated on Fri Jan 30 09:27:05 2009 for DTN Reference Implementation by  doxygen 1.5.8