#include <ProphetTLV.h>
Classes | |
struct | ProphetHeader |
Header Definition p. More... | |
Public Types | |
enum | header_result_t { UnknownResult = 0x0, NoSuccessAck = 0x1, AckAll = 0x2, Success = 0x3, Failure = 0x4, ReturnReceipt = 0x5 } |
Legal values for ProphetHeader.result field p. More... | |
typedef std::list< BaseTLV * > | List |
typedef std::list< BaseTLV * > ::iterator | iterator |
typedef std::list< BaseTLV * > ::const_iterator | const_iterator |
Public Member Functions | |
ProphetTLV (const std::string &src, const std::string &dst, header_result_t result, u_int16_t local_instance, u_int16_t remote_instance, u_int32_t tid) | |
Constructor. | |
ProphetTLV (const ProphetTLV &tlv) | |
Copy constructor. | |
virtual | ~ProphetTLV () |
Destructor. | |
size_t | serialize (u_char *bp, size_t len) const |
Write ProphetTLV out to no more than len bytes of buffer; return bytes written. | |
bool | add_tlv (BaseTLV *tlv) |
Place TLV on list for serialization into next outbound ProphetTLV. | |
BaseTLV * | get_tlv () |
Remove next TLV from list. | |
const std::string & | source () const |
Accessors. | |
const std::string & | destination () const |
Accessors. | |
header_result_t | result () const |
Accessors. | |
u_int16_t | sender_instance () const |
Accessors. | |
u_int16_t | receiver_instance () const |
Accessors. | |
u_int32_t | transaction_id () const |
Accessors. | |
u_int16_t | length () const |
Accessors. | |
size_t | size () const |
Accessors. | |
const List & | list () const |
Accessors. | |
Static Public Member Functions | |
static const char * | result_to_str (header_result_t hr) |
Pretty print function for header_result_t. | |
static ProphetTLV * | deserialize (const std::string &src, const std::string &dst, const u_char *bp, size_t len) |
Read ProphetTLV in from no more than len bytes of buffer; return bytes read. | |
Public Attributes | |
struct prophet::ProphetTLV::ProphetHeader | packed |
Header Definition p. | |
Static Public Attributes | |
static const size_t | ProphetHeaderSize = sizeof(struct ProphetHeader) |
Protected Member Functions | |
ProphetTLV () | |
Protected Attributes | |
std::string | src_ |
destination id for TLV source (from Bundle metadata) | |
std::string | dst_ |
destination id for TLV destination (from Bundle ") | |
header_result_t | result_ |
Disposition of this Prophet TLV. | |
u_int16_t | sender_instance_ |
Local node's index for this encounter. | |
u_int16_t | receiver_instance_ |
Peer's index for this encounter. | |
u_int32_t | tid_ |
Transaction ID for this TLV. | |
u_int16_t | length_ |
Serialized length of this TLV. | |
List | list_ |
Linked list of TLVs embedded in this Prophet TLV. |
Definition at line 26 of file ProphetTLV.h.
typedef std::list<BaseTLV*>::const_iterator prophet::ProphetTLV::const_iterator |
Definition at line 31 of file ProphetTLV.h.
typedef std::list<BaseTLV*>::iterator prophet::ProphetTLV::iterator |
Definition at line 30 of file ProphetTLV.h.
typedef std::list<BaseTLV*> prophet::ProphetTLV::List |
Definition at line 29 of file ProphetTLV.h.
prophet::ProphetTLV::ProphetTLV | ( | const std::string & | src, | |
const std::string & | dst, | |||
header_result_t | result, | |||
u_int16_t | local_instance, | |||
u_int16_t | remote_instance, | |||
u_int32_t | tid | |||
) |
prophet::ProphetTLV::ProphetTLV | ( | const ProphetTLV & | tlv | ) |
prophet::ProphetTLV::~ProphetTLV | ( | ) | [virtual] |
prophet::ProphetTLV::ProphetTLV | ( | ) | [protected] |
Place TLV on list for serialization into next outbound ProphetTLV.
ProphetTLV assumes ownership of memory on submitted pointer, on success.
Definition at line 201 of file ProphetTLV.cc.
References prophet::BaseTLV::length(), length_, and list_.
Referenced by deserialize().
ProphetTLV * prophet::ProphetTLV::deserialize | ( | const std::string & | src, | |
const std::string & | dst, | |||
const u_char * | bp, | |||
size_t | len | |||
) | [static] |
Read ProphetTLV in from no more than len bytes of buffer; return bytes read.
Definition at line 113 of file ProphetTLV.cc.
References add_tlv(), prophet::ProphetTLV::ProphetTLV::ProphetHeader::code, dst_, prophet::ProphetTLV::ProphetTLV::ProphetHeader::flags, prophet::BaseTLV::HELLO_TLV, prophet::BaseTLV::length(), prophet::ProphetTLV::ProphetTLV::ProphetHeader::length, length_, prophet::BaseTLV::OFFER_TLV, prophet::ProphetParams::PROPHET_VERSION, ProphetHeaderSize, ProphetTLV(), prophet::ProphetTLV::ProphetTLV::ProphetHeader::receiver_instance, receiver_instance_, prophet::BaseTLV::RESPONSE_TLV, prophet::ProphetTLV::ProphetTLV::ProphetHeader::result, result_, prophet::BaseTLV::RIB_TLV, prophet::BaseTLV::RIBD_TLV, prophet::ProphetTLV::ProphetTLV::ProphetHeader::sender_instance, sender_instance_, src_, prophet::ProphetTLV::ProphetTLV::ProphetHeader::submessage_flag, prophet::ProphetTLV::ProphetTLV::ProphetHeader::submessage_num, tid_, prophet::ProphetTLV::ProphetTLV::ProphetHeader::transaction_id, prophet::BaseTLV::UNKNOWN_TLV, and prophet::ProphetTLV::ProphetTLV::ProphetHeader::version.
const std::string& prophet::ProphetTLV::destination | ( | ) | const [inline] |
BaseTLV * prophet::ProphetTLV::get_tlv | ( | ) |
Remove next TLV from list.
Caller assumes ownership of memory pointed to by returned pointer (if non-NULL).
Definition at line 191 of file ProphetTLV.cc.
References list_.
u_int16_t prophet::ProphetTLV::length | ( | ) | const [inline] |
const List& prophet::ProphetTLV::list | ( | ) | const [inline] |
u_int16_t prophet::ProphetTLV::receiver_instance | ( | ) | const [inline] |
header_result_t prophet::ProphetTLV::result | ( | ) | const [inline] |
static const char* prophet::ProphetTLV::result_to_str | ( | header_result_t | hr | ) | [inline, static] |
Pretty print function for header_result_t.
Definition at line 172 of file ProphetTLV.h.
References AckAll, Failure, NoSuccessAck, ReturnReceipt, Success, and UnknownResult.
u_int16_t prophet::ProphetTLV::sender_instance | ( | ) | const [inline] |
size_t prophet::ProphetTLV::serialize | ( | u_char * | bp, | |
size_t | len | |||
) | const |
Write ProphetTLV out to no more than len bytes of buffer; return bytes written.
Definition at line 62 of file ProphetTLV.cc.
References prophet::ProphetTLV::ProphetTLV::ProphetHeader::code, prophet::ProphetTLV::ProphetTLV::ProphetHeader::flags, prophet::ProphetTLV::ProphetTLV::ProphetHeader::length, prophet::BaseTLV::length(), length_, list_, prophet::ProphetParams::PROPHET_VERSION, ProphetHeaderSize, prophet::ProphetTLV::ProphetTLV::ProphetHeader::receiver_instance, receiver_instance_, prophet::ProphetTLV::ProphetTLV::ProphetHeader::result, result_, prophet::ProphetTLV::ProphetTLV::ProphetHeader::sender_instance, sender_instance_, prophet::BaseTLV::serialize(), tid_, prophet::ProphetTLV::ProphetTLV::ProphetHeader::transaction_id, and prophet::ProphetTLV::ProphetTLV::ProphetHeader::version.
size_t prophet::ProphetTLV::size | ( | ) | const [inline] |
const std::string& prophet::ProphetTLV::source | ( | ) | const [inline] |
u_int32_t prophet::ProphetTLV::transaction_id | ( | ) | const [inline] |
std::string prophet::ProphetTLV::dst_ [protected] |
destination id for TLV destination (from Bundle ")
Definition at line 248 of file ProphetTLV.h.
Referenced by deserialize(), and destination().
u_int16_t prophet::ProphetTLV::length_ [mutable, protected] |
Serialized length of this TLV.
Definition at line 253 of file ProphetTLV.h.
Referenced by add_tlv(), deserialize(), length(), and serialize().
List prophet::ProphetTLV::list_ [protected] |
Linked list of TLVs embedded in this Prophet TLV.
Definition at line 254 of file ProphetTLV.h.
Referenced by add_tlv(), get_tlv(), list(), ProphetTLV(), serialize(), size(), and ~ProphetTLV().
Header Definition p.
21, 4.2
const size_t prophet::ProphetTLV::ProphetHeaderSize = sizeof(struct ProphetHeader) [static] |
u_int16_t prophet::ProphetTLV::receiver_instance_ [protected] |
Peer's index for this encounter.
Definition at line 251 of file ProphetTLV.h.
Referenced by deserialize(), receiver_instance(), and serialize().
header_result_t prophet::ProphetTLV::result_ [protected] |
Disposition of this Prophet TLV.
Definition at line 249 of file ProphetTLV.h.
Referenced by deserialize(), result(), and serialize().
u_int16_t prophet::ProphetTLV::sender_instance_ [protected] |
Local node's index for this encounter.
Definition at line 250 of file ProphetTLV.h.
Referenced by deserialize(), sender_instance(), and serialize().
std::string prophet::ProphetTLV::src_ [protected] |
destination id for TLV source (from Bundle metadata)
Definition at line 247 of file ProphetTLV.h.
Referenced by deserialize(), and source().
u_int32_t prophet::ProphetTLV::tid_ [protected] |
Transaction ID for this TLV.
Definition at line 252 of file ProphetTLV.h.
Referenced by deserialize(), serialize(), and transaction_id().