Section 4.4.4, p. More...
#include <Encounter.h>
Public Types | |
enum | state_t { UNDEFINED_STATE = 0, WAIT_NB, SYNSENT, SYNRCVD, ESTAB, WAIT_DICT, WAIT_RIB, OFFER, CREATE_DR, SEND_DR, REQUEST, WAIT_INFO } |
Public Member Functions | |
Encounter (const Link *nexthop, Oracle *oracle, u_int16_t instance) | |
Constructor. | |
Encounter (const Encounter &e) | |
Copy constructor. | |
~Encounter () | |
Destructor. | |
void | hello_interval_changed () |
Callback to inform this instance that the hello_interval parameter has changed. | |
bool | receive_tlv (ProphetTLV *tlv) |
Callback for this instance to receive TLVs received from peer by the host bundling system. | |
void | handle_timeout () |
Callback for timeout handler, either due to peer failure or unacceptable delay in messaging. | |
void | handle_bundle_received (const Bundle *b) |
Callback for tracking which Bundle requests are outstanding. | |
bool | operator< (const Encounter &e) const |
Operators. | |
u_int16_t | remote_instance () const |
Accessors. | |
u_int16_t | local_instance () const |
Accessors. | |
const char * | remote_eid () const |
Accessors. | |
const Link * | nexthop () const |
Accessors. | |
state_t | state () const |
Accessors. | |
const char * | state_str () const |
Accessors. | |
bool | neighbor_gone () const |
Accessors. | |
u_int | time_remaining () const |
Accessors. | |
Static Public Member Functions | |
static const char * | state_to_str (state_t st) |
Protected Member Functions | |
bool | dispatch_tlv (BaseTLV *tlv) |
TLV event handlers. | |
bool | handle_hello_tlv (BaseTLV *hello) |
TLV event handlers. | |
bool | handle_ribd_tlv (BaseTLV *ribd) |
TLV event handlers. | |
bool | handle_rib_tlv (BaseTLV *rib) |
TLV event handlers. | |
bool | handle_offer_tlv (BaseTLV *offer) |
TLV event handlers. | |
bool | handle_response_tlv (BaseTLV *response) |
TLV event handlers. | |
bool | send_hello (HelloTLV::hello_hf_t hf, ProphetTLV::header_result_t hr=ProphetTLV::NoSuccessAck, u_int32_t tid=0) |
Outbound message generators. | |
bool | send_dictionary_rib (ProphetTLV::header_result_t hr=ProphetTLV::NoSuccessAck, u_int32_t tid=0) |
Outbound message generators. | |
bool | send_offer (ProphetTLV::header_result_t hr=ProphetTLV::NoSuccessAck, u_int32_t tid=0) |
Outbound message generators. | |
bool | send_response (ProphetTLV::header_result_t hr=ProphetTLV::NoSuccessAck, u_int32_t tid=0) |
Outbound message generators. | |
bool | send_tlv (ProphetTLV *tlv) |
Outbound message generators. | |
Protected Attributes | |
Oracle *const | oracle_ |
collection of Prophet information | |
u_int16_t | local_instance_ |
local's instance for remote | |
u_int16_t | remote_instance_ |
remote's instance for local | |
u_int32_t | tid_ |
transaction id from peer's most recent TLV | |
u_int32_t | next_tid_ |
used to generate TID for outbound TLVs | |
u_int32_t | timeout_ |
most milliseconds expected between TLVs | |
const Link * | next_hop_ |
Link object for this encounter. | |
ProphetTLV * | tlv_ |
most recent message received from peer | |
const bool | synsender_ |
whether active or passive during Hello phase | |
state_t | state_ |
which phase of Prophet protocol for this end | |
bool | synsent_ |
whether hello phase has sent SYN or SYNACK | |
bool | estab_ |
whether hello phase has been completed | |
volatile bool | neighbor_gone_ |
whether session has died | |
Dictionary | local_ribd_ |
16 bit index lookup to translate routes | |
Dictionary | remote_ribd_ |
16 bit index lookup for remote's routes | |
BundleOfferList | remote_offers_ |
in-memory rep of remote's offer | |
BundleResponseList | local_response_ |
Bundle requests sent to peer. | |
Table | remote_nodes_ |
in-memory representation of remote's RIB | |
u_int | hello_rate_ |
simple flow control for Hello messages (ACK, etc) | |
u_int32_t | data_sent_ |
timestamp of last TLV sent | |
u_int32_t | data_rcvd_ |
timestamp of last TLV received | |
Alarm * | alarm_ |
callback registration for timeout handler |
Section 4.4.4, p.
28 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.
Section 4.4.3, p. 27 The Routing Information Base Dictionary includes the list of addresses used in making routing decisions. The referents remain constant for the duration of a session over a link where the instance numbers remain the same and can be used by both the Routing Information Base messages and the bundle offer messages.
Track the state for the Prophet protocol throughout the duration of this encounter between the local node and this remote.
Definition at line 50 of file Encounter.h.
Definition at line 53 of file Encounter.h.
Constructor.
Definition at line 73 of file Encounter.cc.
References alarm_, prophet::Oracle::core(), prophet::BundleCore::create_alarm(), len, LOG, prophet::ExpirationHandler::name(), neighbor_gone_, oracle_, prophet::Link::remote_eid(), send_hello(), prophet::ExpirationHandler::set_name(), SET_STATE, prophet::HelloTLV::SYN, synsender_, SYNSENT, and timeout_.
prophet::Encounter::Encounter | ( | const Encounter & | e | ) |
Copy constructor.
Definition at line 115 of file Encounter.cc.
References alarm_, prophet::Oracle::core(), prophet::BundleCore::create_alarm(), local_instance_, LOG, neighbor_gone_, oracle_, and prophet::Alarm::time_remaining().
prophet::Encounter::~Encounter | ( | ) |
Destructor.
Definition at line 144 of file Encounter.cc.
References alarm_, prophet::Alarm::cancel(), and prophet::Alarm::pending().
TLV event handlers.
Definition at line 258 of file Encounter.cc.
References CREATE_DR, prophet::BaseTLV::ERROR_TLV, estab_, handle_hello_tlv(), handle_offer_tlv(), handle_response_tlv(), handle_rib_tlv(), handle_ribd_tlv(), hello_rate_, prophet::BaseTLV::HELLO_TLV, LOG, NEXT_TID, prophet::BaseTLV::OFFER_TLV, prophet::BaseTLV::RESPONSE_TLV, prophet::BaseTLV::RIB_TLV, prophet::BaseTLV::RIBD_TLV, send_dictionary_rib(), SEND_DR, SEND_SYN, SEND_SYNACK, SET_STATE, state_, SYNRCVD, synsender_, SYNSENT, tid_, prophet::BaseTLV::typecode(), prophet::BaseTLV::UNKNOWN_TLV, WAIT_DICT, and WAIT_INFO.
Referenced by receive_tlv().
void prophet::Encounter::handle_bundle_received | ( | const Bundle * | b | ) |
Callback for tracking which Bundle requests are outstanding.
Definition at line 329 of file Encounter.cc.
References alarm_, prophet::Alarm::cancel(), prophet::Oracle::core(), prophet::BundleCore::create_alarm(), prophet::Bundle::creation_ts(), prophet::Bundle::destination_id(), prophet::Dictionary::find(), prophet::BundleCore::get_route(), prophet::Dictionary::INVALID_SID, local_response_, local_ribd_, LOG, neighbor_gone_, oracle_, prophet::Alarm::pending(), prophet::BundleEntryList< BundleEntryType >::remove_entry(), REQUEST, prophet::Bundle::sequence_num(), state_, and timeout_.
Referenced by prophet::Controller::handle_bundle_received().
TLV event handlers.
Definition at line 464 of file Encounter.cc.
References prophet::HelloTLV::ACK, prophet::Oracle::core(), CREATE_DR, data_sent_, ESTAB, estab_, prophet::ProphetParams::hello_interval(), hello_rate_, prophet::BaseTLV::HELLO_TLV, prophet::HelloTLV::hf(), prophet::HelloTLV::hf_str(), prophet::HelloTLV::HF_UNKNOWN, local_instance_, LOG, next_hop_, OFFER, oracle_, prophet::Oracle::params(), prophet::BundleCore::prophet_id(), prophet::ProphetTLV::receiver_instance(), remote_instance_, REQUEST, prophet::HelloTLV::RSTACK, SEND_ACK, send_dictionary_rib(), SEND_DR, SEND_RSTACK, SEND_SYNACK, prophet::HelloTLV::sender(), prophet::ProphetTLV::sender_instance(), SET_STATE, prophet::ProphetTLV::source(), state_, state_to_str(), prophet::HelloTLV::SYN, prophet::HelloTLV::SYNACK, SYNRCVD, synsender_, SYNSENT, synsent_, tid_, timeout_, prophet::HelloTLV::timer(), tlv_, prophet::BaseTLV::typecode(), UPDATE_PEER_VERIFIER, WAIT_DICT, WAIT_INFO, WAIT_NB, and WAIT_RIB.
Referenced by dispatch_tlv().
TLV event handlers.
Definition at line 716 of file Encounter.cc.
References prophet::OfferTLV::list(), LOG, remote_offers_, REQUEST, SEND_DR, send_response(), SET_STATE, prophet::BundleEntryList< BundleEntryType >::size(), state_, state_str(), and WAIT_INFO.
Referenced by dispatch_tlv().
TLV event handlers.
Definition at line 748 of file Encounter.cc.
References prophet::BundleEntryList< BundleEntryType >::begin(), prophet::BundleCore::bundles(), prophet::Oracle::core(), data_sent_, prophet::Dictionary::dump(), prophet::BundleEntryList< BundleEntryType >::empty(), prophet::BundleEntryList< BundleEntryType >::end(), prophet::BundleCore::find(), prophet::Dictionary::find(), prophet::ResponseTLV::list(), LOG, next_hop_, OFFER, oracle_, remote_ribd_, SEND_ACK, prophet::BundleCore::send_bundle(), SET_STATE, prophet::BundleEntryList< BundleEntryType >::size(), state_, state_to_str(), tid_, WAIT_DICT, WAIT_INFO, and WAIT_RIB.
Referenced by dispatch_tlv().
TLV event handlers.
Definition at line 685 of file Encounter.cc.
References prophet::Table::assign(), prophet::Oracle::core(), prophet::RIBTLV::custody(), prophet::Dictionary::dump(), prophet::RIBTLV::internet(), LOG, next_hop_, prophet::RIBTLV::nodes(), prophet::Oracle::nodes(), OFFER, oracle_, prophet::RIBTLV::relay(), prophet::Link::remote_eid(), remote_nodes_, remote_ribd_, send_offer(), SET_STATE, state_, prophet::Table::update_route(), prophet::Table::update_transitive(), and WAIT_RIB.
Referenced by dispatch_tlv().
TLV event handlers.
Definition at line 646 of file Encounter.cc.
References ASSIGN_ROLES, prophet::Oracle::core(), data_sent_, prophet::Dictionary::dump(), prophet::ProphetParams::hello_interval(), LOG, OFFER, oracle_, prophet::Oracle::params(), remote_ribd_, prophet::RIBDTLV::ribd(), send_offer(), SET_STATE, state_, synsender_, WAIT_DICT, WAIT_INFO, and WAIT_RIB.
Referenced by dispatch_tlv().
void prophet::Encounter::handle_timeout | ( | ) | [virtual] |
Callback for timeout handler, either due to peer failure or unacceptable delay in messaging.
Implements prophet::ExpirationHandler.
Definition at line 368 of file Encounter.cc.
References alarm_, prophet::Alarm::cancel(), prophet::Oracle::core(), prophet::BundleCore::create_alarm(), CREATE_DR, data_rcvd_, ESTAB, prophet::ProphetParams::hello_dead(), prophet::ProphetParams::hello_interval(), LOG, neighbor_gone_, NEXT_TID, OFFER, oracle_, prophet::Oracle::params(), prophet::Alarm::pending(), REQUEST, SEND_ACK, send_dictionary_rib(), SEND_DR, send_offer(), send_response(), SEND_SYN, SEND_SYNACK, SET_STATE, state_, SYNRCVD, synsender_, SYNSENT, tid_, timeout_, WAIT_DICT, WAIT_INFO, WAIT_NB, and WAIT_RIB.
void prophet::Encounter::hello_interval_changed | ( | ) |
Callback to inform this instance that the hello_interval parameter has changed.
Definition at line 151 of file Encounter.cc.
References alarm_, prophet::Alarm::cancel(), prophet::Oracle::core(), prophet::BundleCore::create_alarm(), prophet::ProphetParams::hello_interval(), LOG, neighbor_gone_, oracle_, prophet::Oracle::params(), prophet::Alarm::pending(), prophet::Alarm::time_remaining(), and timeout_.
u_int16_t prophet::Encounter::local_instance | ( | ) | const [inline] |
Accessors.
Definition at line 110 of file Encounter.h.
References local_instance_.
Referenced by prophet::Controller::handle_bundle_received(), and prophet::Controller::new_neighbor().
bool prophet::Encounter::neighbor_gone | ( | ) | const [inline] |
Accessors.
Definition at line 115 of file Encounter.h.
References neighbor_gone_.
Referenced by prophet::Controller::handle_bundle_received(), and prophet::Controller::new_neighbor().
const Link* prophet::Encounter::nexthop | ( | ) | const [inline] |
bool prophet::Encounter::receive_tlv | ( | ProphetTLV * | tlv | ) |
Callback for this instance to receive TLVs received from peer by the host bundling system.
Encounter assumes ownership of memory pointed to by tlv. Return true if message processed successfully. Return false upon fault (peering session died).
Definition at line 201 of file Encounter.cc.
References alarm_, prophet::Alarm::cancel(), prophet::Oracle::core(), prophet::BundleCore::create_alarm(), data_rcvd_, dispatch_tlv(), prophet::ProphetTLV::get_tlv(), LOG, neighbor_gone_, oracle_, prophet::Alarm::pending(), tid_, timeout_, tlv_, and prophet::ProphetTLV::transaction_id().
Referenced by prophet::Controller::handle_bundle_received().
const char* prophet::Encounter::remote_eid | ( | ) | const [inline] |
Accessors.
Definition at line 111 of file Encounter.h.
References next_hop_, and prophet::Link::remote_eid().
u_int16_t prophet::Encounter::remote_instance | ( | ) | const [inline] |
bool prophet::Encounter::send_dictionary_rib | ( | ProphetTLV::header_result_t | hr = ProphetTLV::NoSuccessAck , |
|
u_int32_t | tid = 0 | |||
) | [protected] |
Outbound message generators.
Definition at line 874 of file Encounter.cc.
References prophet::ProphetTLV::add_tlv(), ASSIGN_ROLES, prophet::Oracle::core(), CREATE_DR, prophet::BundleCore::custody_accepted(), prophet::Dictionary::dump(), prophet::ProphetParams::internet_gw(), local_ribd_, LOG, prophet::Oracle::nodes(), oracle_, prophet::Oracle::params(), PROPHET_TLV, prophet::ProphetParams::relay_node(), prophet::TLVCreator::rib(), prophet::RIBDTLV::ribd(), prophet::TLVCreator::ribd(), SEND_DR, send_tlv(), and state_.
Referenced by dispatch_tlv(), handle_hello_tlv(), and handle_timeout().
bool prophet::Encounter::send_hello | ( | HelloTLV::hello_hf_t | hf, | |
ProphetTLV::header_result_t | hr = ProphetTLV::NoSuccessAck , |
|||
u_int32_t | tid = 0 | |||
) | [protected] |
Outbound message generators.
Definition at line 824 of file Encounter.cc.
References prophet::Oracle::core(), data_sent_, prophet::ProphetParams::hello_interval(), hello_rate_, prophet::HelloTLV::hf_str(), prophet::BundleCore::local_eid(), LOG, oracle_, prophet::Oracle::params(), PROPHET_TLV, prophet::HelloTLV::RSTACK, send_tlv(), state_, prophet::HelloTLV::SYN, prophet::HelloTLV::SYNACK, synsent_, timeout_, prophet::HelloTLV::timer(), and WAIT_NB.
Referenced by Encounter().
bool prophet::Encounter::send_offer | ( | ProphetTLV::header_result_t | hr = ProphetTLV::NoSuccessAck , |
|
u_int32_t | tid = 0 | |||
) | [protected] |
Outbound message generators.
Definition at line 939 of file Encounter.cc.
References prophet::ProphetTLV::add_tlv(), prophet::Oracle::core(), prophet::Dictionary::dump(), LOG, next_hop_, prophet::TLVCreator::offer(), oracle_, PROPHET_TLV, remote_nodes_, remote_ribd_, and send_tlv().
Referenced by handle_rib_tlv(), handle_ribd_tlv(), and handle_timeout().
bool prophet::Encounter::send_response | ( | ProphetTLV::header_result_t | hr = ProphetTLV::NoSuccessAck , |
|
u_int32_t | tid = 0 | |||
) | [protected] |
Outbound message generators.
Definition at line 975 of file Encounter.cc.
References prophet::ProphetTLV::add_tlv(), prophet::Oracle::core(), prophet::Dictionary::dump(), prophet::BundleEntryList< BundleEntryType >::empty(), local_response_, local_ribd_, LOG, oracle_, PROPHET_TLV, remote_offers_, prophet::TLVCreator::response(), send_tlv(), SET_STATE, and WAIT_INFO.
Referenced by handle_offer_tlv(), and handle_timeout().
bool prophet::Encounter::send_tlv | ( | ProphetTLV * | tlv | ) | [protected] |
Outbound message generators.
Definition at line 1018 of file Encounter.cc.
References buf, prophet::Oracle::core(), prophet::BundleCore::create_bundle(), data_sent_, prophet::ProphetTLV::destination(), prophet::ProphetParams::hello_dead(), prophet::ProphetParams::hello_interval(), len, prophet::ProphetTLV::length(), LOG, next_hop_, oracle_, prophet::Oracle::params(), prophet::BundleCore::send_bundle(), prophet::ProphetTLV::serialize(), prophet::ProphetTLV::size(), prophet::ProphetTLV::source(), tid_, and prophet::BundleCore::write_bundle().
Referenced by send_dictionary_rib(), send_hello(), send_offer(), and send_response().
state_t prophet::Encounter::state | ( | ) | const [inline] |
const char* prophet::Encounter::state_str | ( | ) | const [inline] |
Accessors.
Definition at line 114 of file Encounter.h.
References state_, and state_to_str().
Referenced by handle_offer_tlv().
static const char* prophet::Encounter::state_to_str | ( | state_t | st | ) | [inline, static] |
Definition at line 68 of file Encounter.h.
References CASE, CREATE_DR, ESTAB, OFFER, REQUEST, SEND_DR, SYNRCVD, SYNSENT, WAIT_DICT, WAIT_INFO, WAIT_NB, and WAIT_RIB.
Referenced by handle_hello_tlv(), handle_response_tlv(), and state_str().
u_int prophet::Encounter::time_remaining | ( | ) | const [inline] |
Accessors.
Definition at line 116 of file Encounter.h.
References alarm_, and prophet::Alarm::time_remaining().
Alarm* prophet::Encounter::alarm_ [protected] |
callback registration for timeout handler
Definition at line 191 of file Encounter.h.
Referenced by Encounter(), handle_bundle_received(), handle_timeout(), hello_interval_changed(), receive_tlv(), time_remaining(), and ~Encounter().
u_int32_t prophet::Encounter::data_rcvd_ [protected] |
timestamp of last TLV received
Definition at line 190 of file Encounter.h.
Referenced by handle_timeout(), and receive_tlv().
u_int32_t prophet::Encounter::data_sent_ [protected] |
timestamp of last TLV sent
Definition at line 189 of file Encounter.h.
Referenced by handle_hello_tlv(), handle_response_tlv(), handle_ribd_tlv(), send_hello(), and send_tlv().
bool prophet::Encounter::estab_ [protected] |
whether hello phase has been completed
Definition at line 181 of file Encounter.h.
Referenced by dispatch_tlv(), and handle_hello_tlv().
u_int prophet::Encounter::hello_rate_ [protected] |
simple flow control for Hello messages (ACK, etc)
Definition at line 188 of file Encounter.h.
Referenced by dispatch_tlv(), handle_hello_tlv(), and send_hello().
u_int16_t prophet::Encounter::local_instance_ [protected] |
local's instance for remote
Definition at line 171 of file Encounter.h.
Referenced by Encounter(), handle_hello_tlv(), and local_instance().
Bundle requests sent to peer.
Definition at line 186 of file Encounter.h.
Referenced by handle_bundle_received(), and send_response().
Dictionary prophet::Encounter::local_ribd_ [protected] |
16 bit index lookup to translate routes
Definition at line 183 of file Encounter.h.
Referenced by handle_bundle_received(), send_dictionary_rib(), and send_response().
volatile bool prophet::Encounter::neighbor_gone_ [protected] |
whether session has died
Definition at line 182 of file Encounter.h.
Referenced by Encounter(), handle_bundle_received(), handle_timeout(), hello_interval_changed(), neighbor_gone(), and receive_tlv().
const Link* prophet::Encounter::next_hop_ [protected] |
Link object for this encounter.
Definition at line 176 of file Encounter.h.
Referenced by handle_hello_tlv(), handle_response_tlv(), handle_rib_tlv(), nexthop(), remote_eid(), send_offer(), and send_tlv().
u_int32_t prophet::Encounter::next_tid_ [protected] |
used to generate TID for outbound TLVs
Definition at line 174 of file Encounter.h.
Oracle* const prophet::Encounter::oracle_ [protected] |
collection of Prophet information
Definition at line 170 of file Encounter.h.
Referenced by Encounter(), handle_bundle_received(), handle_hello_tlv(), handle_response_tlv(), handle_rib_tlv(), handle_ribd_tlv(), handle_timeout(), hello_interval_changed(), receive_tlv(), send_dictionary_rib(), send_hello(), send_offer(), send_response(), and send_tlv().
u_int16_t prophet::Encounter::remote_instance_ [protected] |
remote's instance for local
Definition at line 172 of file Encounter.h.
Referenced by handle_hello_tlv(), operator<(), and remote_instance().
Table prophet::Encounter::remote_nodes_ [protected] |
in-memory representation of remote's RIB
Definition at line 187 of file Encounter.h.
Referenced by handle_rib_tlv(), and send_offer().
BundleOfferList prophet::Encounter::remote_offers_ [protected] |
in-memory rep of remote's offer
Definition at line 185 of file Encounter.h.
Referenced by handle_offer_tlv(), and send_response().
Dictionary prophet::Encounter::remote_ribd_ [protected] |
16 bit index lookup for remote's routes
Definition at line 184 of file Encounter.h.
Referenced by handle_response_tlv(), handle_rib_tlv(), handle_ribd_tlv(), and send_offer().
state_t prophet::Encounter::state_ [protected] |
which phase of Prophet protocol for this end
Definition at line 179 of file Encounter.h.
Referenced by dispatch_tlv(), handle_bundle_received(), handle_hello_tlv(), handle_offer_tlv(), handle_response_tlv(), handle_rib_tlv(), handle_ribd_tlv(), handle_timeout(), send_dictionary_rib(), send_hello(), state(), and state_str().
const bool prophet::Encounter::synsender_ [protected] |
whether active or passive during Hello phase
Definition at line 178 of file Encounter.h.
Referenced by dispatch_tlv(), Encounter(), handle_hello_tlv(), handle_ribd_tlv(), and handle_timeout().
bool prophet::Encounter::synsent_ [protected] |
whether hello phase has sent SYN or SYNACK
Definition at line 180 of file Encounter.h.
Referenced by handle_hello_tlv(), and send_hello().
u_int32_t prophet::Encounter::tid_ [protected] |
transaction id from peer's most recent TLV
Definition at line 173 of file Encounter.h.
Referenced by dispatch_tlv(), handle_hello_tlv(), handle_response_tlv(), handle_timeout(), receive_tlv(), and send_tlv().
u_int32_t prophet::Encounter::timeout_ [protected] |
most milliseconds expected between TLVs
Definition at line 175 of file Encounter.h.
Referenced by Encounter(), handle_bundle_received(), handle_hello_tlv(), handle_timeout(), hello_interval_changed(), receive_tlv(), and send_hello().
ProphetTLV* prophet::Encounter::tlv_ [protected] |
most recent message received from peer
Definition at line 177 of file Encounter.h.
Referenced by handle_hello_tlv(), and receive_tlv().