#include <RIBTLV.h>
Classes | |
struct | RIBEntry |
Routing Information Base entry p. More... | |
struct | RIBTLVHeader |
Routing Information Base TLV p. More... | |
Public Types | |
enum | rib_header_flag_t { RELAY_NODE = 1 << 0, CUSTODY_NODE = 1 << 1, INTERNET_GW_NODE = 1 << 2 } |
RIB Header Flags p. More... | |
typedef RIBNodeList::iterator | iterator |
typedef RIBNodeList::const_iterator | const_iterator |
Public Member Functions | |
RIBTLV (const RIBNodeList &nodes, bool relay, bool custody, bool internet=false) | |
Constructor. | |
virtual | ~RIBTLV () |
Destructor. | |
size_t | serialize (u_char *bp, size_t len) const |
Virtual from BaseTLV. | |
const RIBNodeList & | nodes () const |
Accessors. | |
bool | relay () const |
Accessors. | |
bool | custody () const |
Accessors. | |
bool | internet () const |
Accessors. | |
Public Attributes | |
struct prophet::RIBTLV::RIBTLVHeader | packed |
Routing Information Base TLV p. | |
struct prophet::RIBTLV::RIBEntry | packed |
Routing Information Base entry p. | |
Static Public Attributes | |
static const size_t | RIBTLVHeaderSize = sizeof(struct RIBTLVHeader) |
static const size_t | RIBEntrySize = sizeof(struct RIBEntry) |
Protected Member Functions | |
RIBTLV () | |
Constructor. | |
size_t | write_rib_entry (u_int16_t sid, double pvalue, bool relay, bool custody, bool internet, u_char *bp, size_t len) const |
Serialize routing information base entry out to no more than len bytes of buffer, using struct RIBEntry; return bytes written. | |
size_t | read_rib_entry (u_int16_t *sid, double *pvalue, bool *relay, bool *custody, bool *internet, const u_char *bp, size_t len) |
Deserialize RIBEntry struct from transport into memory, reading no more than len bytes from buffer; return bytes read. | |
bool | deserialize (const u_char *bp, size_t len) |
Virtual from BaseTLV. | |
Static Protected Member Functions | |
static void | decode_flags (u_int8_t flags, bool *relay, bool *custody, bool *internet) |
Utility function for decoding RIB header flags. | |
Protected Attributes | |
RIBNodeList | nodes_ |
List of RIB entries. | |
bool | relay_ |
Whether this node accepts bundles for relay to other nodes. | |
bool | custody_ |
Whether this node accepts custody transfers. | |
bool | internet_ |
Whether this node bridges to the Internet. | |
Friends | |
class | TLVFactory< RIBTLV > |
Definition at line 27 of file RIBTLV.h.
prophet::RIBTLV::RIBTLV | ( | const RIBNodeList & | nodes, | |
bool | relay, | |||
bool | custody, | |||
bool | internet = false | |||
) |
Constructor.
Definition at line 25 of file RIBTLV.cc.
References prophet::BaseTLV::length_, nodes_, RIBEntrySize, and RIBTLVHeaderSize.
virtual prophet::RIBTLV::~RIBTLV | ( | ) | [inline, virtual] |
prophet::RIBTLV::RIBTLV | ( | ) | [protected] |
bool prophet::RIBTLV::custody | ( | ) | const [inline] |
Accessors.
Definition at line 134 of file RIBTLV.h.
References custody_.
Referenced by deserialize(), and prophet::Encounter::handle_rib_tlv().
void prophet::RIBTLV::decode_flags | ( | u_int8_t | flags, | |
bool * | relay, | |||
bool * | custody, | |||
bool * | internet | |||
) | [static, protected] |
Utility function for decoding RIB header flags.
Definition at line 91 of file RIBTLV.cc.
References CUSTODY_NODE, INTERNET_GW_NODE, and RELAY_NODE.
Referenced by deserialize(), and read_rib_entry().
bool prophet::RIBTLV::deserialize | ( | const u_char * | bp, | |
size_t | len | |||
) | [protected, virtual] |
Virtual from BaseTLV.
Implements prophet::BaseTLV.
Definition at line 153 of file RIBTLV.cc.
References custody(), custody_, decode_flags(), prophet::RIBTLV::RIBTLVHeader::flags, prophet::BaseTLV::flags_, internet(), internet_, prophet::RIBTLV::RIBTLVHeader::length, prophet::BaseTLV::length_, nodes_, read_rib_entry(), relay(), relay_, prophet::RIBTLV::RIBTLVHeader::rib_string_count, prophet::BaseTLV::RIB_TLV, RIBEntrySize, RIBTLVHeaderSize, prophet::Node::set_custody(), prophet::Node::set_internet_gw(), prophet::Node::set_pvalue(), prophet::Node::set_relay(), prophet::RIBNode::sid_, prophet::RIBTLV::RIBTLVHeader::type, and prophet::BaseTLV::typecode_.
bool prophet::RIBTLV::internet | ( | ) | const [inline] |
Accessors.
Definition at line 135 of file RIBTLV.h.
References internet_.
Referenced by deserialize(), and prophet::Encounter::handle_rib_tlv().
const RIBNodeList& prophet::RIBTLV::nodes | ( | ) | const [inline] |
Accessors.
Definition at line 132 of file RIBTLV.h.
References nodes_.
Referenced by prophet::Encounter::handle_rib_tlv().
size_t prophet::RIBTLV::read_rib_entry | ( | u_int16_t * | sid, | |
double * | pvalue, | |||
bool * | relay, | |||
bool * | custody, | |||
bool * | internet, | |||
const u_char * | bp, | |||
size_t | len | |||
) | [protected] |
Deserialize RIBEntry struct from transport into memory, reading no more than len bytes from buffer; return bytes read.
Definition at line 130 of file RIBTLV.cc.
References decode_flags(), prophet::RIBTLV::RIBEntry::flags, prophet::RIBTLV::RIBEntry::pvalue, RIBEntrySize, and prophet::RIBTLV::RIBEntry::string_id.
Referenced by deserialize().
bool prophet::RIBTLV::relay | ( | ) | const [inline] |
Accessors.
Definition at line 133 of file RIBTLV.h.
References relay_.
Referenced by deserialize(), and prophet::Encounter::handle_rib_tlv().
size_t prophet::RIBTLV::serialize | ( | u_char * | bp, | |
size_t | len | |||
) | const [virtual] |
Virtual from BaseTLV.
Implements prophet::BaseTLV.
Definition at line 40 of file RIBTLV.cc.
References prophet::Node::custody(), custody_, CUSTODY_NODE, prophet::RIBTLV::RIBTLVHeader::flags, internet_, prophet::Node::internet_gw(), INTERNET_GW_NODE, prophet::RIBTLV::RIBTLVHeader::length, prophet::BaseTLV::length_, nodes_, prophet::Node::p_value(), prophet::Node::relay(), relay_, RELAY_NODE, prophet::RIBTLV::RIBTLVHeader::rib_string_count, prophet::BaseTLV::RIB_TLV, RIBEntrySize, RIBTLVHeaderSize, prophet::RIBNode::sid_, prophet::RIBTLV::RIBTLVHeader::type, prophet::BaseTLV::typecode_, and write_rib_entry().
size_t prophet::RIBTLV::write_rib_entry | ( | u_int16_t | sid, | |
double | pvalue, | |||
bool | relay, | |||
bool | custody, | |||
bool | internet, | |||
u_char * | bp, | |||
size_t | len | |||
) | const [protected] |
Serialize routing information base entry out to no more than len bytes of buffer, using struct RIBEntry; return bytes written.
Definition at line 105 of file RIBTLV.cc.
References CUSTODY_NODE, prophet::RIBTLV::RIBEntry::flags, INTERNET_GW_NODE, prophet::RIBTLV::RIBEntry::pvalue, RELAY_NODE, RIBEntrySize, and prophet::RIBTLV::RIBEntry::string_id.
Referenced by serialize().
friend class TLVFactory< RIBTLV > [friend] |
bool prophet::RIBTLV::custody_ [protected] |
Whether this node accepts custody transfers.
Definition at line 176 of file RIBTLV.h.
Referenced by custody(), deserialize(), and serialize().
bool prophet::RIBTLV::internet_ [protected] |
Whether this node bridges to the Internet.
Definition at line 177 of file RIBTLV.h.
Referenced by deserialize(), internet(), and serialize().
RIBNodeList prophet::RIBTLV::nodes_ [protected] |
List of RIB entries.
Definition at line 173 of file RIBTLV.h.
Referenced by deserialize(), nodes(), RIBTLV(), and serialize().
Routing Information Base entry p.
28, 4.4.4
Routing Information Base TLV
p.
28, 4.4.4
The Routing Information Base lists the destinations a node knows of, and the delivery predictabilities it has associated with them. This information is needed by the PRoPHET algorithm to make decisions on routing and forwarding.
bool prophet::RIBTLV::relay_ [protected] |
Whether this node accepts bundles for relay to other nodes.
Definition at line 174 of file RIBTLV.h.
Referenced by deserialize(), relay(), and serialize().
const size_t prophet::RIBTLV::RIBEntrySize = sizeof(struct RIBEntry) [static] |
Definition at line 111 of file RIBTLV.h.
Referenced by deserialize(), read_rib_entry(), RIBTLV(), serialize(), and write_rib_entry().
const size_t prophet::RIBTLV::RIBTLVHeaderSize = sizeof(struct RIBTLVHeader) [static] |
Definition at line 109 of file RIBTLV.h.
Referenced by deserialize(), RIBTLV(), and serialize().