#include <ProphetEncounter.h>
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 69 of file ProphetEncounter.h.
Public Types | ||||
enum | pemsg_t { PEMSG_INVALID = 0, PEMSG_PROPHET_TLV_RECEIVED, PEMSG_HELLO_INTERVAL_CHANGED, PEMSG_NEIGHBOR_GONE } | |||
Section 2.3 refers to NEW_NEIGHBOR and NEIGHBOR_GONE signals The definition of ProphetEncounter is that each instance is created in response to NEW_NEIGHBOR and shutdown in response to NEIGHBOR_GONE. More... | ||||
enum | prophet_state_t { UNDEFINED = 0, WAIT_NB, SYNSENT, SYNRCVD, ESTAB, WAIT_DICT, WAIT_RIB, OFFER, CREATE_DR, SEND_DR, REQUEST, WAIT_INFO } | |||
Public Member Functions | ||||
const char * | pemsg_to_str (pemsg_t type) | |||
ProphetEncounter (Link *nexthop, ProphetOracle *oracle) | ||||
| ||||
virtual | ~ProphetEncounter () | |||
void | receive_tlv (ProphetTLV *) | |||
Call-back function for ProphetController to deliver Prophet control messages to this instance. | ||||
u_int16_t | remote_instance () const | |||
Link instance used by remote (sender_instance on inbound messages, receiver_instance on outbound). | ||||
u_int16_t | local_instance () const | |||
Link instance used by local (receiver_instance on inbound messages, sender_instance on outbound). | ||||
const EndpointID & | remote_eid () const | |||
bool | operator< (const ProphetEncounter &p) const | |||
bool | operator< (u_int16_t instance) const | |||
Link * | next_hop () const | |||
void | reset_link () | |||
Page 34, section 5.2 The procedure "Reset the link" is defined as 1. | ||||
void | neighbor_gone () | |||
Page 13, section 2.3, Lower Layer Requirements and Interface. | ||||
void | flush_pending () | |||
If a link changes to BUSY while sending, then bundles queue up. | ||||
void | dump_state (oasys::StringBuffer *buf) | |||
void | handle_bundle_received (Bundle *) | |||
void | hello_interval_changed () | |||
Static Public Member Functions | ||||
static const char * | state_to_str (prophet_state_t st) | |||
Protected Member Functions | ||||
void | run () | |||
ProphetEncounter's main responsibility is to implement the Prophet protocol as described by Section 5. | ||||
void | update_peer_verifier (u_int16_t instance) | |||
Page 33, section 5.2 The "Update Peer Verifier" operation is defined as storing the values of the Sender Instance and Sender Local Address fields from a Hello SYN or Hello SYNACK function received from the entity at the far end of the link. | ||||
void | process_command () | |||
Process command received from IPC via MsgQueue. | ||||
void | handle_prophet_tlv (ProphetTLV *pt) | |||
Demultiplex TLV by typecode and dispatch to appropriate handler. | ||||
bool | handle_hello_tlv (HelloTLV *hello, ProphetTLV *pt) | |||
Hello TLV handler. | ||||
bool | handle_ribd_tlv (RIBDTLV *ribd, ProphetTLV *pt) | |||
Dictionary TLV handler. | ||||
bool | handle_rib_tlv (RIBTLV *rib, ProphetTLV *pt) | |||
Delivery predictability TLV handler. | ||||
bool | handle_bundle_tlv (BundleTLV *btlv, ProphetTLV *pt) | |||
Bundle offer/request TLV handler. | ||||
bool | handle_bad_protocol (u_int32_t tid) | |||
Handles irregularities in protocol. | ||||
void | handle_neighbor_gone () | |||
Cleanup. | ||||
void | handle_poll_timeout () | |||
State-appropriate response to timeout. | ||||
void | switch_info_role () | |||
As per Prophet I-D, this implementation makes a single-threaded pass through each of the Information Exchange phases (Initiator and Listener); this method facilitates the switch between phases. | ||||
void | reset_ribd () | |||
Reset local dictionary to 0 for sender, 1 for listener (as per Hello phase roles). | ||||
void | handle_hello_interval_changed () | |||
Interrupt run() if necessary, to respond to console imperative. | ||||
void | send_dictionary () | |||
Package and send local dictionary and RIB. | ||||
void | send_bundle_offer () | |||
Package and send Bundle offer (or request, as appropriate). | ||||
ProphetTLV * | outbound_tlv (u_int32_t tid, Prophet::header_result_t result) | |||
Create and return a new ProphetTLV. | ||||
bool | send_prophet_tlv () | |||
Encapsulate outbound TLV into Bundle, hand off to Link for delivery. | ||||
bool | should_fwd (Bundle *bundle) | |||
Check link status to determine whether ok to forward. | ||||
void | fwd_to_nexthop (Bundle *bundle, bool add_front=false) | |||
Given a bundle, forward to remote. | ||||
void | enqueue_hello (Prophet::hello_hf_t hf, u_int32_t tid=0, Prophet::header_result_t result=Prophet::NoSuccessAck) | |||
Send an outbound TLV. | ||||
void | enqueue_ribd (const ProphetDictionary &ribd, u_int32_t tid=0, Prophet::header_result_t result=Prophet::NoSuccessAck) | |||
Send an outbound TLV. | ||||
void | enqueue_rib (const RIBTLV::List &nodes, u_int32_t tid=0, Prophet::header_result_t result=Prophet::NoSuccessAck) | |||
Send an outbound TLV. | ||||
void | enqueue_bundle_tlv (const BundleOfferList &list, u_int32_t tid=0, Prophet::header_result_t result=Prophet::NoSuccessAck) | |||
Send an outbound TLV. | ||||
void | set_state (prophet_state_t) | |||
Convenience function enforces valid state transitions and controls concurrent requests for access to state variable. | ||||
prophet_state_t | get_state (const char *where) | |||
Convenience function enforces valid state transitions and controls concurrent requests for access to state variable. | ||||
Protected Attributes | ||||
ProphetOracle * | oracle_ | |||
calling parent | ||||
u_int16_t | remote_instance_ | |||
local's instance for remote | ||||
std::string | remote_addr_ | |||
Sender Local Address for remote. | ||||
u_int16_t | local_instance_ | |||
remote's instance for local | ||||
u_int32_t | tid_ | |||
transaction ID from peer's most recent TLV | ||||
u_int32_t | timeout_ | |||
poll timeout | ||||
u_int32_t | ack_count_ | |||
Section 5.2.1, Note 2, no more than 2 ACKs ... | ||||
Link * | next_hop_ | |||
Link object for this encounter. | ||||
bool | synsender_ | |||
whether active or passive during hello phase | ||||
bool | initiator_ | |||
whether active or passive during information exchange | ||||
bool | synsent_ | |||
whether Hello SYN has been sent | ||||
bool | synrcvd_ | |||
whether Hello SYN has been received | ||||
bool | estab_ | |||
whether Hello sequence has been completed | ||||
bool | dictsent_ | |||
whether dictionary has been sent | ||||
volatile bool | neighbor_gone_ | |||
indicates underlying CL signal | ||||
prophet_state_t | state_ | |||
represents which phase of Prophet FSM | ||||
ProphetDictionary | ribd_ | |||
dictionary for EID to StringID lookups | ||||
BundleOfferList | offers_ | |||
List of offers received from remote. | ||||
BundleOfferList | requests_ | |||
List of offers requested from remote. | ||||
oasys::MsgQueue< PEMsg > | cmdqueue_ | |||
command dispatch queue | ||||
ProphetTable | remote_nodes_ | |||
list of remote's p_values | ||||
BundleList | to_be_fwd_ | |||
holding tank in case of blocked send | ||||
Prophet::header_result_t | result_ | |||
whether a response is requested | ||||
oasys::Time | data_sent_ | |||
last time a message was sent | ||||
oasys::Time | data_rcvd_ | |||
last time a message was received | ||||
ProphetTLV * | outbound_tlv_ | |||
outbound Prophet control messages | ||||
oasys::SpinLock * | state_lock_ | |||
control access to state_ variable | ||||
oasys::SpinLock * | otlv_lock_ | |||
control access to outbound_tlv_ variable | ||||
Private Member Functions | ||||
ProphetEncounter (const ProphetEncounter &pe) | ||||
Deny access to copy constructor. | ||||
Classes | ||||
struct | PEMsg |
Section 2.3 refers to NEW_NEIGHBOR and NEIGHBOR_GONE signals The definition of ProphetEncounter is that each instance is created in response to NEW_NEIGHBOR and shutdown in response to NEIGHBOR_GONE.
Section 5.2 refers to two independent events that affect the state machine (implemented by ProphetEncounter): "the timer expires, and a packet arrives". This packet is a Prophet control message, instantiated as ProphetTLV.
PEMSG_INVALID | |
PEMSG_PROPHET_TLV_RECEIVED | |
PEMSG_HELLO_INTERVAL_CHANGED | |
PEMSG_NEIGHBOR_GONE |
Definition at line 85 of file ProphetEncounter.h.
UNDEFINED | |
WAIT_NB | Waiting for Neighbor. |
SYNSENT | Sent SYN, waiting for SYNACK. |
SYNRCVD | Received SYN, sent SYNACK, waiting for ACK. |
ESTAB | Prophet link established with remote. |
WAIT_DICT | Listener mode of bundle-passing phase. |
WAIT_RIB | Listener rcvd RIBD, waiting for RIB. |
OFFER | Listener sent Offer, waiting for Request. |
CREATE_DR | Initiator creates and sends RIBD and RIB. |
SEND_DR | Initiator sent RIBD and RIB, waiting for Offer. |
REQUEST | Initiator sent Request, waiting for Bundles. |
WAIT_INFO | All phases now complete, waiting for timer or ACK. |
Definition at line 134 of file ProphetEncounter.h.
dtn::ProphetEncounter::ProphetEncounter | ( | Link * | nexthop, | |
ProphetOracle * | oracle | |||
) |
nexthop | Link on which new neighbor detected |
controller | parent caller |
Definition at line 30 of file ProphetEncounter.cc.
References ack_count_, dtn::ProphetOracle::acks(), dtn::ProphetOracle::actions(), ASSERT, dtn::ProphetOracle::bundles(), data_rcvd_, data_sent_, dtn::EndpointID::equals(), oasys::Time::get_time(), dtn::ProphetParams::hello_interval_, dtn::Link::local(), local_instance_, oasys::Logger::logpath_appendf(), dtn::ProphetOracle::nodes(), dtn::EndpointID::NULL_EID(), dtn::BundleOffer::OFFER, offers_, oracle_, dtn::ProphetOracle::params(), dtn::Link::remote_eid(), requests_, dtn::BundleOffer::RESPONSE, dtn::BundleOfferList::set_type(), dtn::ProphetOracle::stats(), and timeout_.
dtn::ProphetEncounter::ProphetEncounter | ( | const ProphetEncounter & | pe | ) | [inline, private] |
dtn::ProphetEncounter::~ProphetEncounter | ( | ) | [virtual] |
Definition at line 83 of file ProphetEncounter.cc.
References ASSERT, cmdqueue_, ExamineDump::l, otlv_lock_, outbound_tlv_, state_lock_, dtn::ProphetEncounter::PEMsg::tlv_, and oasys::ScopeLockIf::unlock().
const char* dtn::ProphetEncounter::pemsg_to_str | ( | pemsg_t | type | ) | [inline] |
Definition at line 92 of file ProphetEncounter.h.
References PEMSG_HELLO_INTERVAL_CHANGED, PEMSG_INVALID, PEMSG_NEIGHBOR_GONE, and PEMSG_PROPHET_TLV_RECEIVED.
static const char* dtn::ProphetEncounter::state_to_str | ( | prophet_state_t | st | ) | [inline, static] |
Definition at line 149 of file ProphetEncounter.h.
References CASE, CREATE_DR, ESTAB, OFFER, REQUEST, SEND_DR, SYNRCVD, SYNSENT, WAIT_DICT, WAIT_INFO, WAIT_NB, and WAIT_RIB.
Referenced by dump_state(), get_state(), handle_hello_tlv(), and set_state().
void dtn::ProphetEncounter::receive_tlv | ( | ProphetTLV * | pt | ) |
Call-back function for ProphetController to deliver Prophet control messages to this instance.
Definition at line 263 of file ProphetEncounter.cc.
References cmdqueue_, log_debug, and PEMSG_PROPHET_TLV_RECEIVED.
u_int16_t dtn::ProphetEncounter::remote_instance | ( | ) | const [inline] |
Link instance used by remote (sender_instance on inbound messages, receiver_instance on outbound).
Definition at line 178 of file ProphetEncounter.h.
References remote_instance_.
u_int16_t dtn::ProphetEncounter::local_instance | ( | ) | const [inline] |
Link instance used by local (receiver_instance on inbound messages, sender_instance on outbound).
Definition at line 184 of file ProphetEncounter.h.
References local_instance_.
Referenced by dtn::ProphetController::reg(), and dtn::ProphetController::unreg().
const EndpointID& dtn::ProphetEncounter::remote_eid | ( | ) | const [inline] |
Definition at line 186 of file ProphetEncounter.h.
References next_hop_, and dtn::Link::remote_eid().
Referenced by dtn::ProphetController::new_neighbor().
bool dtn::ProphetEncounter::operator< | ( | const ProphetEncounter & | p | ) | const |
bool dtn::ProphetEncounter::operator< | ( | u_int16_t | instance | ) | const |
Link* dtn::ProphetEncounter::next_hop | ( | ) | const [inline] |
void dtn::ProphetEncounter::reset_link | ( | ) |
Page 34, section 5.2
The procedure "Reset the link" is defined as
1.
Generate a new instance number for the link.
2. Delete the peer verifier (set to zero the values of Sender
Instance and Sender Local Address previously stored by the
Update Peer Verifier operation).
3. Send a SYN message.
4. Enter the SYNSENT state.
Definition at line 221 of file ProphetEncounter.cc.
References log_debug, and neighbor_gone().
void dtn::ProphetEncounter::neighbor_gone | ( | ) |
Page 13, section 2.3, Lower Layer Requirements and Interface.
Definition at line 271 of file ProphetEncounter.cc.
References cmdqueue_, log_debug, and PEMSG_NEIGHBOR_GONE.
Referenced by reset_link(), and dtn::ProphetController::shutdown().
void dtn::ProphetEncounter::flush_pending | ( | ) | [inline] |
If a link changes to BUSY while sending, then bundles queue up.
When the link changes back to AVAILABLE, this signal indicates to flush outbound queue.
Definition at line 216 of file ProphetEncounter.h.
References fwd_to_nexthop().
Referenced by dtn::ProphetController::handle_link_state_change_request().
void dtn::ProphetEncounter::dump_state | ( | oasys::StringBuffer * | buf | ) |
Definition at line 1146 of file ProphetEncounter.cc.
References oasys::StringBuffer::appendf(), dtn::EndpointID::c_str(), next_hop_, dtn::Link::remote_eid(), remote_instance_, state_, and state_to_str().
Referenced by dtn::ProphetController::dump_state().
void dtn::ProphetEncounter::handle_bundle_received | ( | Bundle * | bundle | ) |
Definition at line 228 of file ProphetEncounter.cc.
References dtn::Prophet::eid_to_route(), dtn::Prophet::eid_to_routeid(), enqueue_bundle_tlv(), dtn::ProphetDictionary::find(), fwd_to_nexthop(), get_state(), log_debug, dtn::EndpointIDPattern::match(), next_hop_, oasys::Ref< _Type >::object(), dtn::Link::remote_eid(), dtn::BundleOfferList::remove_bundle(), REQUEST, requests_, ribd_, send_prophet_tlv(), set_state(), should_fwd(), dtn::BundleOfferList::size(), and WAIT_INFO.
Referenced by dtn::ProphetController::handle_bundle_received().
void dtn::ProphetEncounter::hello_interval_changed | ( | ) | [inline] |
Definition at line 220 of file ProphetEncounter.h.
References cmdqueue_, log_notice, and PEMSG_HELLO_INTERVAL_CHANGED.
Referenced by dtn::ProphetController::handle_hello_interval_change().
void dtn::ProphetEncounter::run | ( | ) | [protected, virtual] |
ProphetEncounter's main responsibility is to implement the Prophet protocol as described by Section 5.
Implements oasys::Thread.
Definition at line 1545 of file ProphetEncounter.cc.
References ASSERT, dtn::ProphetTable::clear(), cmdqueue_, data_rcvd_, enqueue_hello(), oasys::Time::get_time(), handle_neighbor_gone(), handle_poll_timeout(), dtn::ProphetParams::hello_dead_, initiator_, oasys::IOTIMEOUT, log_debug, log_err, neighbor_gone_, next_hop_, oracle_, dtn::ProphetOracle::params(), oasys::IO::poll_single(), process_command(), oasys::Random::rand(), dtn::Link::remote_eid(), remote_nodes_, send_prophet_tlv(), set_state(), dtn::Prophet::SYN, synsender_, SYNSENT, and timeout_.
void dtn::ProphetEncounter::update_peer_verifier | ( | u_int16_t | instance | ) | [inline, protected] |
Page 33, section 5.2 The "Update Peer Verifier" operation is defined as storing the values of the Sender Instance and Sender Local Address fields from a Hello SYN or Hello SYNACK function received from the entity at the far end of the link.
Definition at line 239 of file ProphetEncounter.h.
References next_hop_, dtn::Link::nexthop(), remote_addr_, and remote_instance_.
Referenced by handle_hello_tlv().
void dtn::ProphetEncounter::process_command | ( | ) | [protected] |
Process command received from IPC via MsgQueue.
Definition at line 1511 of file ProphetEncounter.cc.
References ASSERT, cmdqueue_, handle_hello_interval_changed(), handle_neighbor_gone(), handle_prophet_tlv(), log_debug, PEMSG_HELLO_INTERVAL_CHANGED, PEMSG_NEIGHBOR_GONE, PEMSG_PROPHET_TLV_RECEIVED, dtn::ProphetEncounter::PEMsg::tlv_, and dtn::ProphetEncounter::PEMsg::type_.
Referenced by run().
void dtn::ProphetEncounter::handle_prophet_tlv | ( | ProphetTLV * | pt | ) | [protected] |
Demultiplex TLV by typecode and dispatch to appropriate handler.
Definition at line 379 of file ProphetEncounter.cc.
References ASSERT, dtn::Prophet::BUNDLE_TLV, oasys::StringBuffer::c_str(), data_rcvd_, dtn::ProphetTLV::dump(), dtn::Prophet::ERROR_TLV, estab_, oasys::Time::get_time(), dtn::ProphetTLV::get_tlv(), handle_bad_protocol(), handle_bundle_tlv(), handle_hello_tlv(), handle_rib_tlv(), handle_ribd_tlv(), dtn::Prophet::HELLO_TLV, dtn::ProphetTLV::list(), log_debug, neighbor_gone_, dtn::ProphetTLV::num_tlv(), dtn::ProphetTLV::result(), dtn::Prophet::result_to_str(), dtn::Prophet::RIB_TLV, dtn::Prophet::RIBD_TLV, tid_, dtn::ProphetTLV::transaction_id(), dtn::BaseTLV::typecode(), and dtn::Prophet::UNKNOWN_TLV.
Referenced by process_command().
bool dtn::ProphetEncounter::handle_hello_tlv | ( | HelloTLV * | hello, | |
ProphetTLV * | pt | |||
) | [protected] |
Hello TLV handler.
Definition at line 441 of file ProphetEncounter.cc.
References dtn::Prophet::ACK, ack_count_, ASSERT, CREATE_DR, enqueue_hello(), ESTAB, dtn::Prophet::Failure, get_state(), handle_neighbor_gone(), dtn::ProphetParams::hello_interval_, dtn::Prophet::HELLO_TLV, dtn::HelloTLV::hf(), dtn::Prophet::hf_to_str(), local_instance_, log_debug, log_err, log_info, next_hop_, dtn::Link::nexthop(), OFFER, oracle_, dtn::ProphetOracle::params(), dtn::ProphetTLV::receiver_instance(), remote_addr_, remote_instance_, REQUEST, dtn::Prophet::RSTACK, SEND_DR, send_prophet_tlv(), dtn::ProphetTLV::sender_instance(), set_state(), state_to_str(), dtn::Prophet::Success, dtn::Prophet::SYN, dtn::Prophet::SYNACK, SYNRCVD, SYNSENT, synsent_, timeout_, dtn::HelloTLV::timer(), dtn::ProphetTLV::transaction_id(), dtn::BaseTLV::typecode(), update_peer_verifier(), WAIT_DICT, WAIT_NB, and WAIT_RIB.
Referenced by handle_prophet_tlv().
bool dtn::ProphetEncounter::handle_ribd_tlv | ( | RIBDTLV * | ribd, | |
ProphetTLV * | pt | |||
) | [protected] |
Dictionary TLV handler.
Definition at line 713 of file ProphetEncounter.cc.
References dtn::ProphetDictionary::assign(), dtn::ProphetDictionary::begin(), dtn::EndpointID::c_str(), dtn::ProphetDictionary::dump(), dtn::Prophet::eid_to_routeid(), dtn::ProphetDictionary::end(), get_state(), log_debug, OFFER, dtn::RIBDTLV::ribd(), ribd_, set_state(), dtn::ProphetDictionary::size(), WAIT_DICT, and WAIT_RIB.
Referenced by handle_prophet_tlv().
bool dtn::ProphetEncounter::handle_rib_tlv | ( | RIBTLV * | rib, | |
ProphetTLV * | pt | |||
) | [protected] |
Delivery predictability TLV handler.
Definition at line 751 of file ProphetEncounter.cc.
References ASSERT, dtn::ProphetNode::custody(), dtn::RIBTLV::custody_node(), dtn::Prophet::eid_to_routeid(), dtn::EndpointID::equals(), dtn::ProphetDictionary::find(), dtn::ProphetTable::find(), get_state(), dtn::RIBTLV::internet_gateway(), dtn::ProphetNode::internet_gw(), log_debug, next_hop_, dtn::ProphetOracle::nodes(), dtn::RIBTLV::nodes(), dtn::EndpointID::NULL_EID(), OFFER, oracle_, dtn::ProphetNode::p_value(), dtn::ProphetOracle::params(), dtn::ProphetNode::relay(), dtn::RIBTLV::relay_node(), dtn::Link::remote_eid(), remote_nodes_, ribd_, dtn::ProphetNode::set_custody(), dtn::ProphetNode::set_eid(), dtn::ProphetNode::set_internet_gw(), dtn::ProphetNode::set_pvalue(), dtn::ProphetNode::set_relay(), set_state(), dtn::RIBNode::sid_, dtn::ProphetTable::update(), dtn::ProphetNode::update_pvalue(), and WAIT_RIB.
Referenced by handle_prophet_tlv().
bool dtn::ProphetEncounter::handle_bundle_tlv | ( | BundleTLV * | btlv, | |
ProphetTLV * | pt | |||
) | [protected] |
Bundle offer/request TLV handler.
Definition at line 822 of file ProphetEncounter.cc.
References dtn::Prophet::ACK, dtn::ProphetOracle::acks(), dtn::BundleOfferList::add_offer(), ASSERT, dtn::ProphetBundleQueue::bundle_list(), dtn::ProphetOracle::bundles(), dtn::BundleList::clear(), dtn::BundleOfferList::clear(), custody, dtn::ProphetBundleQueue::drop_bundle(), enqueue_bundle_tlv(), enqueue_hello(), dtn::EndpointID::equals(), dtn::Prophet::Failure, dtn::ProphetBundleList::find(), dtn::ProphetDictionary::find(), fwd_to_nexthop(), get_state(), dtn::ProphetAckList::insert(), dtn::ProphetAckList::is_ackd(), ExamineDump::l, dtn::BundleTLV::list(), dtn::BundleOfferList::lock(), dtn::ProphetBundleQueue::lock(), log_debug, dtn::ProphetOracle::nodes(), dtn::EndpointID::NULL_EID(), oasys::Ref< _Type >::object(), dtn::BundleOffer::OFFER, OFFER, offers_, oracle_, REQUEST, requests_, dtn::BundleOffer::RESPONSE, ribd_, SEND_DR, send_prophet_tlv(), set_state(), dtn::BundleOfferList::set_type(), should_fwd(), dtn::BundleList::size(), dtn::BundleOfferList::size(), dtn::BundleOfferList::sort(), dtn::Prophet::Success, synsender_, dtn::ProphetTLV::transaction_id(), dtn::BundleOfferList::type(), WAIT_DICT, WAIT_INFO, and WAIT_RIB.
Referenced by handle_prophet_tlv().
bool dtn::ProphetEncounter::handle_bad_protocol | ( | u_int32_t | tid | ) | [protected] |
Handles irregularities in protocol.
Definition at line 681 of file ProphetEncounter.cc.
References data_sent_, enqueue_hello(), dtn::Prophet::Failure, get_state(), oasys::Time::get_time(), log_debug, send_prophet_tlv(), dtn::Prophet::SYN, dtn::Prophet::SYNACK, SYNRCVD, SYNSENT, and timeout_.
Referenced by handle_prophet_tlv().
void dtn::ProphetEncounter::handle_neighbor_gone | ( | ) | [protected] |
Cleanup.
Definition at line 986 of file ProphetEncounter.cc.
References local_instance_, log_debug, log_info, neighbor_gone_, and next_hop_.
Referenced by handle_hello_tlv(), process_command(), and run().
void dtn::ProphetEncounter::handle_poll_timeout | ( | ) | [protected] |
State-appropriate response to timeout.
Definition at line 995 of file ProphetEncounter.cc.
References dtn::Prophet::ACK, ack_count_, CREATE_DR, data_sent_, enqueue_bundle_tlv(), enqueue_hello(), ESTAB, get_state(), oasys::Time::get_time(), dtn::ProphetParams::hello_dead_, log_debug, OFFER, oracle_, dtn::ProphetOracle::params(), REQUEST, requests_, send_bundle_offer(), send_dictionary(), SEND_DR, send_prophet_tlv(), set_state(), dtn::BundleOfferList::size(), dtn::Prophet::Success, switch_info_role(), dtn::Prophet::SYN, dtn::Prophet::SYNACK, SYNRCVD, synsender_, SYNSENT, tid_, timeout_, WAIT_DICT, WAIT_INFO, WAIT_NB, and WAIT_RIB.
Referenced by run().
void dtn::ProphetEncounter::switch_info_role | ( | ) | [protected] |
As per Prophet I-D, this implementation makes a single-threaded pass through each of the Information Exchange phases (Initiator and Listener); this method facilitates the switch between phases.
Definition at line 1114 of file ProphetEncounter.cc.
References ASSERT, CREATE_DR, get_state(), initiator_, set_state(), synsender_, WAIT_DICT, and WAIT_INFO.
Referenced by handle_poll_timeout(), and set_state().
void dtn::ProphetEncounter::reset_ribd | ( | ) | [protected] |
Reset local dictionary to 0 for sender, 1 for listener (as per Hello phase roles).
Definition at line 1096 of file ProphetEncounter.cc.
References ASSERT, dtn::ProphetDictionary::assign(), dtn::ProphetDictionary::clear(), next_hop_, dtn::Link::remote_eid(), ribd_, and synsender_.
Referenced by set_state().
void dtn::ProphetEncounter::handle_hello_interval_changed | ( | ) | [protected] |
Interrupt run() if necessary, to respond to console imperative.
Definition at line 1540 of file ProphetEncounter.cc.
References dtn::ProphetParams::hello_interval_, oracle_, dtn::ProphetOracle::params(), and timeout_.
Referenced by process_command().
void dtn::ProphetEncounter::send_dictionary | ( | ) | [protected] |
Package and send local dictionary and RIB.
Definition at line 1275 of file ProphetEncounter.cc.
References ASSERT, dtn::ProphetBundleQueue::bundle_list(), dtn::ProphetOracle::bundles(), dtn::ProphetTable::dump_table(), dtn::Prophet::eid_to_routeid(), enqueue_rib(), enqueue_ribd(), dtn::ProphetDictionary::find(), dtn::ProphetDictionary::insert(), dtn::ProphetDictionary::is_assigned(), ExamineDump::l, dtn::ProphetBundleQueue::lock(), log_debug, next_hop_, dtn::ProphetOracle::nodes(), dtn::Prophet::NoSuccessAck, oracle_, dtn::ProphetOracle::params(), dtn::ProphetNode::remote_eid(), dtn::Link::remote_eid(), ribd_, send_prophet_tlv(), dtn::ProphetNode::set_eid(), synsender_, dtn::Prophet::UniqueID::tid(), and dtn::ProphetTable::update().
Referenced by handle_poll_timeout(), and send_bundle_offer().
void dtn::ProphetEncounter::send_bundle_offer | ( | ) | [protected] |
Package and send Bundle offer (or request, as appropriate).
Definition at line 1154 of file ProphetEncounter.cc.
References dtn::ProphetOracle::acks(), dtn::BundleOfferList::add_offer(), ASSERT, dtn::ProphetBundleQueue::bundle_list(), dtn::ProphetOracle::bundles(), dtn::ProphetAck::cts_, dtn::ProphetDecider::decider(), dtn::ProphetAck::dest_id_, dtn::Prophet::eid_to_routeid(), enqueue_bundle_tlv(), dtn::ProphetAckList::fetch(), dtn::ProphetDictionary::find(), dtn::ProphetParams::fs_, get_state(), dtn::ProphetDictionary::insert(), dtn::ProphetDictionary::is_assigned(), ExamineDump::l, dtn::ProphetBundleQueue::lock(), log_debug, dtn::ProphetParams::max_forward_, next_hop_, dtn::ProphetOracle::nodes(), oasys::Ref< _Type >::object(), dtn::BundleOffer::OFFER, OFFER, offers_, oracle_, dtn::ProphetOracle::params(), remote_nodes_, ribd_, send_dictionary(), send_prophet_tlv(), dtn::BundleOfferList::set_type(), dtn::ProphetOracle::stats(), dtn::FwdStrategy::strategy(), synsender_, and WAIT_RIB.
Referenced by handle_poll_timeout(), and set_state().
void dtn::ProphetEncounter::enqueue_hello | ( | Prophet::hello_hf_t | hf, | |
u_int32_t | tid = 0 , |
|||
Prophet::header_result_t | result = Prophet::NoSuccessAck | |||
) | [protected] |
Send an outbound TLV.
If tid is non-zero, set Prophet header to use it, otherwise generate a new tid.
Definition at line 1440 of file ProphetEncounter.cc.
References dtn::ProphetTLV::add_tlv(), ASSERT, dtn::ProphetParams::hello_interval_, dtn::Prophet::hf_to_str(), ExamineDump::l, log_debug, oasys::Logger::logpath_, oracle_, otlv_lock_, outbound_tlv(), dtn::ProphetOracle::params(), and dtn::Prophet::result_to_str().
Referenced by handle_bad_protocol(), handle_bundle_tlv(), handle_hello_tlv(), handle_poll_timeout(), and run().
void dtn::ProphetEncounter::enqueue_ribd | ( | const ProphetDictionary & | ribd, | |
u_int32_t | tid = 0 , |
|||
Prophet::header_result_t | result = Prophet::NoSuccessAck | |||
) | [protected] |
Send an outbound TLV.
If tid is non-zero, set Prophet header to use it, otherwise generate a new tid.
Definition at line 1460 of file ProphetEncounter.cc.
References dtn::ProphetTLV::add_tlv(), ASSERT, ExamineDump::l, log_debug, oasys::Logger::logpath_, otlv_lock_, outbound_tlv(), dtn::Prophet::result_to_str(), and dtn::ProphetDictionary::size().
Referenced by send_dictionary().
void dtn::ProphetEncounter::enqueue_rib | ( | const RIBTLV::List & | nodes, | |
u_int32_t | tid = 0 , |
|||
Prophet::header_result_t | result = Prophet::NoSuccessAck | |||
) | [protected] |
Send an outbound TLV.
If tid is non-zero, set Prophet header to use it, otherwise generate a new tid.
Definition at line 1477 of file ProphetEncounter.cc.
References dtn::ProphetTLV::add_tlv(), ASSERT, dtn::ProphetParams::custody_node_, dtn::ProphetParams::internet_gw_, ExamineDump::l, log_debug, oasys::Logger::logpath_, oracle_, otlv_lock_, outbound_tlv(), dtn::ProphetOracle::params(), and dtn::ProphetParams::relay_node_.
Referenced by send_dictionary().
void dtn::ProphetEncounter::enqueue_bundle_tlv | ( | const BundleOfferList & | list, | |
u_int32_t | tid = 0 , |
|||
Prophet::header_result_t | result = Prophet::NoSuccessAck | |||
) | [protected] |
Send an outbound TLV.
If tid is non-zero, set Prophet header to use it, otherwise generate a new tid.
Definition at line 1496 of file ProphetEncounter.cc.
References dtn::ProphetTLV::add_tlv(), ASSERT, ExamineDump::l, log_debug, oasys::Logger::logpath_, otlv_lock_, outbound_tlv(), and dtn::BundleOfferList::size().
Referenced by handle_bundle_received(), handle_bundle_tlv(), handle_poll_timeout(), and send_bundle_offer().
ProphetTLV * dtn::ProphetEncounter::outbound_tlv | ( | u_int32_t | tid, | |
Prophet::header_result_t | result | |||
) | [protected] |
Create and return a new ProphetTLV.
Definition at line 1366 of file ProphetEncounter.cc.
References ExamineDump::l, local_instance_, log_err, otlv_lock_, outbound_tlv_, remote_instance_, dtn::ProphetTLV::result(), dtn::Prophet::result_to_str(), and dtn::ProphetTLV::transaction_id().
Referenced by enqueue_bundle_tlv(), enqueue_hello(), enqueue_rib(), and enqueue_ribd().
bool dtn::ProphetEncounter::send_prophet_tlv | ( | ) | [protected] |
Encapsulate outbound TLV into Bundle, hand off to Link for delivery.
Definition at line 1399 of file ProphetEncounter.cc.
References ASSERT, oasys::StringBuffer::c_str(), dtn::ProphetTLV::create_bundle(), data_sent_, dtn::ProphetTLV::dump(), fwd_to_nexthop(), oasys::Time::get_time(), ExamineDump::l, log_debug, log_err, neighbor_gone_, next_hop_, dtn::ProphetTLV::num_tlv(), oasys::Ref< _Type >::object(), otlv_lock_, outbound_tlv_, and dtn::Link::remote_eid().
Referenced by handle_bad_protocol(), handle_bundle_received(), handle_bundle_tlv(), handle_hello_tlv(), handle_poll_timeout(), run(), send_bundle_offer(), and send_dictionary().
Check link status to determine whether ok to forward.
Definition at line 279 of file ProphetEncounter.cc.
References ASSERT, dtn::ForwardingInfo::IN_FLIGHT, info, log_debug, dtn::Link::name(), next_hop_, dtn::ForwardingInfo::NONE, dtn::ForwardingInfo::state_, dtn::ForwardingInfo::state_to_str(), dtn::ForwardingInfo::TRANSMIT_FAILED, and dtn::ForwardingInfo::TRANSMITTED.
Referenced by handle_bundle_received(), and handle_bundle_tlv().
Given a bundle, forward to remote.
Definition at line 323 of file ProphetEncounter.cc.
References dtn::ProphetOracle::actions(), ASSERT, dtn::BundleList::begin(), dtn::ForwardingInfo::COPY_ACTION, dtn::BundleList::end(), dtn::Link::isbusy(), dtn::Link::isopen(), ExamineDump::l, dtn::BundleList::lock(), log_debug, log_err, next_hop_, oasys::Ref< _Type >::object(), oracle_, dtn::ProphetTable::p_value(), dtn::BundleList::pop_front(), dtn::BundleList::push_back(), dtn::BundleList::push_front(), remote_nodes_, dtn::BundleActions::send_bundle(), dtn::BundleList::size(), dtn::ProphetOracle::stats(), to_be_fwd_, and dtn::ProphetStats::update_stats().
Referenced by flush_pending(), handle_bundle_received(), handle_bundle_tlv(), and send_prophet_tlv().
void dtn::ProphetEncounter::set_state | ( | prophet_state_t | new_state | ) | [protected] |
Convenience function enforces valid state transitions and controls concurrent requests for access to state variable.
Definition at line 124 of file ProphetEncounter.cc.
References ack_count_, ASSERT, CREATE_DR, ESTAB, estab_, dtn::ProphetParams::hello_interval_, initiator_, ExamineDump::l, log_debug, OFFER, oracle_, dtn::ProphetOracle::params(), REQUEST, reset_ribd(), send_bundle_offer(), SEND_DR, state_, state_lock_, state_to_str(), switch_info_role(), SYNRCVD, synrcvd_, synsender_, SYNSENT, synsent_, timeout_, WAIT_DICT, WAIT_INFO, WAIT_NB, and WAIT_RIB.
Referenced by handle_bundle_received(), handle_bundle_tlv(), handle_hello_tlv(), handle_poll_timeout(), handle_rib_tlv(), handle_ribd_tlv(), run(), and switch_info_role().
ProphetEncounter::prophet_state_t dtn::ProphetEncounter::get_state | ( | const char * | where | ) | [protected] |
Convenience function enforces valid state transitions and controls concurrent requests for access to state variable.
Definition at line 116 of file ProphetEncounter.cc.
References ExamineDump::l, log_debug, state_, state_lock_, and state_to_str().
Referenced by handle_bad_protocol(), handle_bundle_received(), handle_bundle_tlv(), handle_hello_tlv(), handle_poll_timeout(), handle_rib_tlv(), handle_ribd_tlv(), send_bundle_offer(), and switch_info_role().
ProphetOracle* dtn::ProphetEncounter::oracle_ [protected] |
calling parent
Definition at line 366 of file ProphetEncounter.h.
Referenced by enqueue_hello(), enqueue_rib(), fwd_to_nexthop(), handle_bundle_tlv(), handle_hello_interval_changed(), handle_hello_tlv(), handle_poll_timeout(), handle_rib_tlv(), ProphetEncounter(), run(), send_bundle_offer(), send_dictionary(), and set_state().
u_int16_t dtn::ProphetEncounter::remote_instance_ [protected] |
local's instance for remote
Definition at line 367 of file ProphetEncounter.h.
Referenced by dump_state(), handle_hello_tlv(), outbound_tlv(), remote_instance(), and update_peer_verifier().
std::string dtn::ProphetEncounter::remote_addr_ [protected] |
Sender Local Address for remote.
Definition at line 368 of file ProphetEncounter.h.
Referenced by handle_hello_tlv(), and update_peer_verifier().
u_int16_t dtn::ProphetEncounter::local_instance_ [protected] |
remote's instance for local
Definition at line 369 of file ProphetEncounter.h.
Referenced by handle_hello_tlv(), handle_neighbor_gone(), local_instance(), operator<(), outbound_tlv(), and ProphetEncounter().
u_int32_t dtn::ProphetEncounter::tid_ [protected] |
transaction ID from peer's most recent TLV
Definition at line 370 of file ProphetEncounter.h.
Referenced by handle_poll_timeout(), and handle_prophet_tlv().
u_int32_t dtn::ProphetEncounter::timeout_ [protected] |
poll timeout
Definition at line 371 of file ProphetEncounter.h.
Referenced by handle_bad_protocol(), handle_hello_interval_changed(), handle_hello_tlv(), handle_poll_timeout(), ProphetEncounter(), run(), and set_state().
u_int32_t dtn::ProphetEncounter::ack_count_ [protected] |
Section 5.2.1, Note 2, no more than 2 ACKs ...
Definition at line 372 of file ProphetEncounter.h.
Referenced by handle_hello_tlv(), handle_poll_timeout(), ProphetEncounter(), and set_state().
Link* dtn::ProphetEncounter::next_hop_ [protected] |
Link object for this encounter.
Definition at line 373 of file ProphetEncounter.h.
Referenced by dump_state(), fwd_to_nexthop(), handle_bundle_received(), handle_hello_tlv(), handle_neighbor_gone(), handle_rib_tlv(), next_hop(), remote_eid(), reset_ribd(), run(), send_bundle_offer(), send_dictionary(), send_prophet_tlv(), should_fwd(), and update_peer_verifier().
bool dtn::ProphetEncounter::synsender_ [protected] |
whether active or passive during hello phase
Definition at line 374 of file ProphetEncounter.h.
Referenced by handle_bundle_tlv(), handle_poll_timeout(), reset_ribd(), run(), send_bundle_offer(), send_dictionary(), set_state(), and switch_info_role().
bool dtn::ProphetEncounter::initiator_ [protected] |
whether active or passive during information exchange
Definition at line 375 of file ProphetEncounter.h.
Referenced by run(), set_state(), and switch_info_role().
bool dtn::ProphetEncounter::synsent_ [protected] |
whether Hello SYN has been sent
Definition at line 376 of file ProphetEncounter.h.
Referenced by handle_hello_tlv(), and set_state().
bool dtn::ProphetEncounter::synrcvd_ [protected] |
whether Hello SYN has been received
Definition at line 377 of file ProphetEncounter.h.
Referenced by set_state().
bool dtn::ProphetEncounter::estab_ [protected] |
whether Hello sequence has been completed
Definition at line 378 of file ProphetEncounter.h.
Referenced by handle_prophet_tlv(), and set_state().
bool dtn::ProphetEncounter::dictsent_ [protected] |
volatile bool dtn::ProphetEncounter::neighbor_gone_ [protected] |
indicates underlying CL signal
Definition at line 380 of file ProphetEncounter.h.
Referenced by handle_neighbor_gone(), handle_prophet_tlv(), run(), and send_prophet_tlv().
prophet_state_t dtn::ProphetEncounter::state_ [protected] |
represents which phase of Prophet FSM
Definition at line 381 of file ProphetEncounter.h.
Referenced by dump_state(), get_state(), and set_state().
ProphetDictionary dtn::ProphetEncounter::ribd_ [protected] |
dictionary for EID to StringID lookups
Definition at line 382 of file ProphetEncounter.h.
Referenced by handle_bundle_received(), handle_bundle_tlv(), handle_rib_tlv(), handle_ribd_tlv(), reset_ribd(), send_bundle_offer(), and send_dictionary().
BundleOfferList dtn::ProphetEncounter::offers_ [protected] |
List of offers received from remote.
Definition at line 383 of file ProphetEncounter.h.
Referenced by handle_bundle_tlv(), ProphetEncounter(), and send_bundle_offer().
BundleOfferList dtn::ProphetEncounter::requests_ [protected] |
List of offers requested from remote.
Definition at line 384 of file ProphetEncounter.h.
Referenced by handle_bundle_received(), handle_bundle_tlv(), handle_poll_timeout(), and ProphetEncounter().
oasys::MsgQueue<PEMsg> dtn::ProphetEncounter::cmdqueue_ [protected] |
command dispatch queue
Definition at line 385 of file ProphetEncounter.h.
Referenced by hello_interval_changed(), neighbor_gone(), process_command(), receive_tlv(), run(), and ~ProphetEncounter().
ProphetTable dtn::ProphetEncounter::remote_nodes_ [protected] |
list of remote's p_values
Definition at line 386 of file ProphetEncounter.h.
Referenced by fwd_to_nexthop(), handle_rib_tlv(), run(), and send_bundle_offer().
BundleList dtn::ProphetEncounter::to_be_fwd_ [protected] |
holding tank in case of blocked send
Definition at line 387 of file ProphetEncounter.h.
Referenced by fwd_to_nexthop().
oasys::Time dtn::ProphetEncounter::data_sent_ [protected] |
last time a message was sent
Definition at line 389 of file ProphetEncounter.h.
Referenced by handle_bad_protocol(), handle_poll_timeout(), ProphetEncounter(), and send_prophet_tlv().
oasys::Time dtn::ProphetEncounter::data_rcvd_ [protected] |
last time a message was received
Definition at line 390 of file ProphetEncounter.h.
Referenced by handle_prophet_tlv(), ProphetEncounter(), and run().
ProphetTLV* dtn::ProphetEncounter::outbound_tlv_ [protected] |
outbound Prophet control messages
Definition at line 391 of file ProphetEncounter.h.
Referenced by outbound_tlv(), send_prophet_tlv(), and ~ProphetEncounter().
oasys::SpinLock* dtn::ProphetEncounter::state_lock_ [protected] |
control access to state_ variable
Definition at line 392 of file ProphetEncounter.h.
Referenced by get_state(), set_state(), and ~ProphetEncounter().
oasys::SpinLock* dtn::ProphetEncounter::otlv_lock_ [protected] |
control access to outbound_tlv_ variable
Definition at line 393 of file ProphetEncounter.h.
Referenced by enqueue_bundle_tlv(), enqueue_hello(), enqueue_rib(), enqueue_ribd(), outbound_tlv(), send_prophet_tlv(), and ~ProphetEncounter().