#include <BaseTLV.h>
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.
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 |
virtual prophet::BaseTLV::~BaseTLV | ( | ) | [inline, virtual] |
prophet::BaseTLV::BaseTLV | ( | prophet_tlv_t | typecode = UNKNOWN_TLV , |
|
u_int8_t | flags = 0 , |
|||
u_int16_t | length = 0 | |||
) | [inline, protected] |
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.
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().
prophet_tlv_t prophet::BaseTLV::typecode | ( | ) | const [inline] |
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 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.
prophet_tlv_t prophet::BaseTLV::typecode_ [protected] |
typecode for this TLV
Definition at line 125 of file BaseTLV.h.
Referenced by prophet::RIBTLV::deserialize(), prophet::ResponseTLV::deserialize(), prophet::OfferTLV::deserialize(), prophet::RIBTLV::serialize(), prophet::RIBDTLV::serialize(), prophet::ResponseTLV::serialize(), prophet::OfferTLV::serialize(), prophet::HelloTLV::serialize(), and typecode().
u_int8_t prophet::BaseTLV::flags_ [protected] |
TLV-specific flags.
Definition at line 126 of file BaseTLV.h.
Referenced by prophet::RIBTLV::deserialize(), prophet::RIBDTLV::deserialize(), prophet::ResponseTLV::deserialize(), prophet::OfferTLV::deserialize(), and flags().
u_int16_t prophet::BaseTLV::length_ [mutable, protected] |
serialized length of TLV, mutable so it can be assigned by serialize() const
Definition at line 127 of file BaseTLV.h.
Referenced by prophet::RIBTLV::deserialize(), prophet::RIBDTLV::deserialize(), prophet::ResponseTLV::deserialize(), prophet::OfferTLV::deserialize(), prophet::HelloTLV::deserialize(), length(), prophet::RIBDTLV::RIBDTLV(), prophet::RIBTLV::RIBTLV(), prophet::RIBTLV::serialize(), prophet::RIBDTLV::serialize(), prophet::ResponseTLV::serialize(), prophet::OfferTLV::serialize(), and prophet::HelloTLV::serialize().