#include <ProphetLists.h>
Definition at line 301 of file ProphetLists.h.
Public Types | |
typedef std::map< u_int16_t, EndpointID > | rribd |
typedef rribd::const_iterator | const_iterator |
Public Member Functions | |
ProphetDictionary (const EndpointID &sender=EndpointID::NULL_EID(), const EndpointID &receiver=EndpointID::NULL_EID()) | |
ProphetDictionary (const ProphetDictionary &pd) | |
~ProphetDictionary () | |
u_int16_t | find (const EndpointID &eid) const |
If eid is valid, returns sid; else zero. | |
EndpointID | find (u_int16_t id) const |
If id is valid, returns EID; else NULL_EID. | |
EndpointID | sender () const |
Convenience function. | |
EndpointID | receiver () const |
Convenience function. | |
bool | is_assigned (const EndpointID &eid) const |
If EID is already indexed, return true; else false. | |
u_int16_t | insert (const EndpointID &eid) |
Attempts to insert EID, returns SID upon success (zero if collision). | |
bool | assign (const EndpointID &eid, u_int16_t sid) |
Assign EID to arbitrary SID; returns true upon success (false if collision). | |
const_iterator | begin () const |
Iterator (std::pair<u_int16_t,EndpointID>). | |
const_iterator | end () const |
Iterator (std::pair<u_int16_t,EndpointID>). | |
size_t | size () const |
Return the number of elements in the dictionary. | |
size_t | guess_ribd_size () const |
Helper function for serializing dictionary. | |
void | clear () |
Wipe out dictionary (prepare to deserialize new one). | |
void | dump (oasys::StringBuffer *buf) |
Write out text representation to string buffer. | |
ProphetDictionary & | operator= (const ProphetDictionary &d) |
Protected Types | |
typedef std::map< EndpointID, u_int16_t, less_eid_ > | ribd |
Protected Member Functions | |
void | update_guess (size_t len) |
Protected Attributes | |
ribd | ribd_ |
rribd | rribd_ |
size_t | guess_ |
typedef std::map<u_int16_t,EndpointID> dtn::ProphetDictionary::rribd |
Definition at line 304 of file ProphetLists.h.
typedef rribd::const_iterator dtn::ProphetDictionary::const_iterator |
Definition at line 305 of file ProphetLists.h.
typedef std::map<EndpointID,u_int16_t,less_eid_> dtn::ProphetDictionary::ribd [protected] |
Definition at line 387 of file ProphetLists.h.
dtn::ProphetDictionary::ProphetDictionary | ( | const EndpointID & | sender = EndpointID::NULL_EID() , |
|
const EndpointID & | receiver = EndpointID::NULL_EID() | |||
) |
Definition at line 209 of file ProphetLists.cc.
References clear(), dtn::EndpointID::equals(), dtn::EndpointID::NULL_EID(), receiver(), ribd_, rribd_, and sender().
dtn::ProphetDictionary::ProphetDictionary | ( | const ProphetDictionary & | pd | ) |
Definition at line 229 of file ProphetLists.cc.
dtn::ProphetDictionary::~ProphetDictionary | ( | ) | [inline] |
Definition at line 310 of file ProphetLists.h.
u_int16_t dtn::ProphetDictionary::find | ( | const EndpointID & | eid | ) | const |
If eid is valid, returns sid; else zero.
Definition at line 247 of file ProphetLists.cc.
References ASSERT, dtn::EndpointID::equals(), dtn::EndpointID::NULL_EID(), and ribd_.
Referenced by dtn::ProphetEncounter::handle_bundle_received(), dtn::ProphetEncounter::handle_bundle_tlv(), dtn::ProphetEncounter::handle_rib_tlv(), dtn::BundleOfferComp::operator()(), receiver(), dtn::ProphetEncounter::send_bundle_offer(), dtn::ProphetEncounter::send_dictionary(), and sender().
EndpointID dtn::ProphetDictionary::find | ( | u_int16_t | id | ) | const |
If id is valid, returns EID; else NULL_EID.
Definition at line 259 of file ProphetLists.cc.
References dtn::EndpointID::NULL_EID(), and rribd_.
EndpointID dtn::ProphetDictionary::sender | ( | ) | const [inline] |
Convenience function.
Definition at line 325 of file ProphetLists.h.
References find().
Referenced by assign(), and ProphetDictionary().
EndpointID dtn::ProphetDictionary::receiver | ( | ) | const [inline] |
Convenience function.
Definition at line 330 of file ProphetLists.h.
References find().
Referenced by assign(), and ProphetDictionary().
bool dtn::ProphetDictionary::is_assigned | ( | const EndpointID & | eid | ) | const |
If EID is already indexed, return true; else false.
Definition at line 235 of file ProphetLists.cc.
References ASSERT, dtn::EndpointID::equals(), dtn::EndpointID::NULL_EID(), and ribd_.
Referenced by dtn::ProphetEncounter::send_bundle_offer(), and dtn::ProphetEncounter::send_dictionary().
u_int16_t dtn::ProphetDictionary::insert | ( | const EndpointID & | eid | ) |
Attempts to insert EID, returns SID upon success (zero if collision).
Definition at line 269 of file ProphetLists.cc.
References ASSERT, assign(), dtn::EndpointID::equals(), dtn::EndpointID::NULL_EID(), and ribd_.
Referenced by dtn::ProphetEncounter::send_bundle_offer(), and dtn::ProphetEncounter::send_dictionary().
bool dtn::ProphetDictionary::assign | ( | const EndpointID & | eid, | |
u_int16_t | sid | |||
) |
Assign EID to arbitrary SID; returns true upon success (false if collision).
Definition at line 278 of file ProphetLists.cc.
References ASSERT, dtn::EndpointID::equals(), dtn::EndpointID::NULL_EID(), receiver(), ribd_, rribd_, sender(), and update_guess().
Referenced by dtn::RIBDTLV::deserialize(), dtn::ProphetEncounter::handle_ribd_tlv(), insert(), and dtn::ProphetEncounter::reset_ribd().
const_iterator dtn::ProphetDictionary::begin | ( | ) | const [inline] |
Iterator (std::pair<u_int16_t,EndpointID>).
Definition at line 352 of file ProphetLists.h.
References rribd_.
Referenced by dtn::ProphetEncounter::handle_ribd_tlv(), and dtn::RIBDTLV::serialize().
const_iterator dtn::ProphetDictionary::end | ( | ) | const [inline] |
Iterator (std::pair<u_int16_t,EndpointID>).
Definition at line 357 of file ProphetLists.h.
References rribd_.
Referenced by dtn::ProphetEncounter::handle_ribd_tlv(), and dtn::RIBDTLV::serialize().
size_t dtn::ProphetDictionary::size | ( | ) | const [inline] |
Return the number of elements in the dictionary.
Definition at line 362 of file ProphetLists.h.
References ribd_.
Referenced by dtn::RIBDTLV::dump(), dtn::ProphetEncounter::enqueue_ribd(), dtn::ProphetEncounter::handle_ribd_tlv(), and dtn::RIBDTLV::serialize().
size_t dtn::ProphetDictionary::guess_ribd_size | ( | ) | const [inline] |
Helper function for serializing dictionary.
Definition at line 367 of file ProphetLists.h.
References guess_.
Referenced by dtn::RIBDTLV::RIBDTLV(), and dtn::RIBDTLV::serialize().
void dtn::ProphetDictionary::clear | ( | ) |
Wipe out dictionary (prepare to deserialize new one).
Definition at line 316 of file ProphetLists.cc.
References guess_, ribd_, and rribd_.
Referenced by dtn::RIBDTLV::deserialize(), ProphetDictionary(), and dtn::ProphetEncounter::reset_ribd().
void dtn::ProphetDictionary::dump | ( | oasys::StringBuffer * | buf | ) |
Write out text representation to string buffer.
Definition at line 191 of file ProphetLists.cc.
References oasys::StringBuffer::appendf(), and rribd_.
Referenced by dtn::RIBDTLV::dump(), and dtn::ProphetEncounter::handle_ribd_tlv().
ProphetDictionary& dtn::ProphetDictionary::operator= | ( | const ProphetDictionary & | d | ) | [inline] |
void dtn::ProphetDictionary::update_guess | ( | size_t | len | ) | [inline, protected] |
Definition at line 389 of file ProphetLists.h.
References FOUR_BYTE_ALIGN, guess_, and dtn::Prophet::RoutingAddressStringSize.
Referenced by assign().
ribd dtn::ProphetDictionary::ribd_ [protected] |
Definition at line 393 of file ProphetLists.h.
Referenced by assign(), clear(), find(), insert(), is_assigned(), operator=(), ProphetDictionary(), and size().
rribd dtn::ProphetDictionary::rribd_ [protected] |
Definition at line 394 of file ProphetLists.h.
Referenced by assign(), begin(), clear(), dump(), end(), find(), operator=(), and ProphetDictionary().
size_t dtn::ProphetDictionary::guess_ [protected] |
Definition at line 395 of file ProphetLists.h.
Referenced by clear(), guess_ribd_size(), operator=(), and update_guess().