#include <ProphetController.h>
Inheritance diagram for dtn::ProphetController:
ProphetEncounter represents the active exchange of information between local and ProphetEncounter::remote_; as such, it is the state machine described by the Prophet internet draft (March 2006). Any context-specific information exchanged between nodes (such as RIBD) is kept by ProphetEncounter. Once the RIB is echanged, delivery predictability updates take place in ProphetTable, and thus affect all instances of ProphetEncounter.
ProphetController is the control piece that interacts with the BundleRouter API. It keeps a set of active ProphetEncounters as well as the authoritative ProphetTable.
The Prophet protocol requires the following primitives from its bundle agent/routing agent interface:
Get Bundle List
the controller keeps a list (
bundles_)<br> | Send Bundle actions_->send_bundle() Accept Bundle bundles_->push_back(bundle) Bundle Delivered BundleDaemon::post(new BundleDeliveredEvent()) Drop Bundle actions_->delete_bundle(bundle) bundles_->erase(bundle) |
Definition at line 79 of file ProphetController.h.
Public Member Functions | |
ProphetController () | |
Constructor. | |
void | do_init (ProphetParams *params, const BundleList *bundles, BundleActions *actions, const char *logpath) |
Initialization function, called by init() at construction time. | |
virtual | ~ProphetController () |
Prophet::fwd_strategy_t | fwd_strategy () const |
void | set_fwd_strategy (Prophet::fwd_strategy_t f) |
Prophet::q_policy_t | q_policy () const |
void | set_q_policy (Prophet::q_policy_t q) |
void | dump_state (oasys::StringBuffer *) |
Snarf something intelligent from TableBasedRouter ? | |
void | handle_bundle_received (Bundle *, const ContactRef &) |
Prophet's handler for receiving all Bundles, including Prophet control messages (TLVs). | |
void | handle_bundle_expired (Bundle *) |
Handler for bundle expired event. | |
void | handle_bundle_delivered (Bundle *) |
Handler for bundle delivered event. | |
void | handle_link_state_change_request (const ContactRef &) |
Handler for when a busy link becomes available. | |
void | new_neighbor (const ContactRef &) |
New link has come up; attempt to establish contact. | |
void | neighbor_gone (const ContactRef &) |
Existing link has gone away; clean up state. | |
void | handle_queue_policy_change (Prophet::q_policy_t qp) |
Callback to handle queue policy change. | |
void | handle_hello_interval_change (u_int hello_interval) |
Callback to handle hello_interval change. | |
void | handle_max_usage_change (u_int max_usage) |
Callback to handle max_usage change. | |
void | shutdown () |
Callback to shutdown ProphetEncounter threads prior to destructor. | |
bool | reg (ProphetEncounter *pe) |
bool | unreg (ProphetEncounter *pe) |
ProphetParams * | params () |
virtual from ProphetOracle | |
ProphetBundleQueue * | bundles () |
virtual from ProphetOracle | |
ProphetTable * | nodes () |
virtual from ProphetOracle | |
BundleActions * | actions () |
virtual from ProphetOracle | |
ProphetAckList * | acks () |
virtual from ProphetOracle | |
ProphetStats * | stats () |
virtual from ProphetOracle | |
Static Public Member Functions | |
static void | init (ProphetParams *params, const BundleList *bundles, BundleActions *actions, const char *logpath="/dtn/route/prophet/controller") |
Factory method (invoked instead of constructor). | |
static bool | is_init () |
Protected Types | |
typedef std::set< ProphetEncounter * > | enc_set |
Protected Member Functions | |
double | p_value (Bundle *) |
Look up and return the delivery predictability (p_value) for this Bundle. | |
ProphetEncounter * | find_instance (Link *link) |
Protected Attributes | |
ProphetParams * | params_ |
Prophet parameters, to share among ProphetEncounters. | |
enc_set | encounters_ |
The collection of active sessions with other Prophet nodes. | |
oasys::SpinLock * | lock_ |
Control concurrent access to encounter list. | |
ProphetTable | nodes_ |
Authoritative list of all Prophet nodes seen by local node. | |
ProphetTableAgeTimer * | node_age_timer_ |
Applies aging algorithm to node table. | |
ProphetAckAgeTimer * | ack_age_timer_ |
Timer to effect Prophet ACK expiration. | |
ProphetAckList | acks_ |
All bundles ProphetRouter has ACKs for. | |
ProphetStats | pstats_ |
Used to track various statistics for forwarding and queuing. | |
BundleActions * | actions_ |
Router's bundle action object. | |
ProphetBundleQueue * | bundles_ |
Bounded Priority Queue with queuing policy ordering. | |
EndpointID | prophet_eid_ |
EndpointID of this Prophet instance. |
typedef std::set<ProphetEncounter*> dtn::ProphetController::enc_set [protected] |
Definition at line 258 of file ProphetController.h.
dtn::ProphetController::ProphetController | ( | ) |
Constructor.
Definition at line 62 of file ProphetController.cc.
References dtn::EndpointID::append_service_tag(), ASSERT, dtn::EndpointID::assign(), encounters_, dtn::Prophet::UniqueID::init(), and prophet_eid_.
Referenced by init().
dtn::ProphetController::~ProphetController | ( | ) | [virtual] |
Definition at line 76 of file ProphetController.cc.
References ack_age_timer_, bundles_, lock_, and node_age_timer_.
void dtn::ProphetController::do_init | ( | ProphetParams * | params, | |
const BundleList * | bundles, | |||
BundleActions * | actions, | |||
const char * | logpath | |||
) |
Initialization function, called by init() at construction time.
Definition at line 35 of file ProphetController.cc.
References ack_age_timer_, acks_, actions(), actions_, dtn::ProphetParams::age_period_, ASSERT, bundles_, dtn::ProphetParams::epsilon_, lock_, node_age_timer_, nodes_, params(), params_, pstats_, dtn::ProphetParams::qp_, dtn::QueueComp::queuecomp(), and oasys::Logger::set_logpath().
static void dtn::ProphetController::init | ( | ProphetParams * | params, | |
const BundleList * | bundles, | |||
BundleActions * | actions, | |||
const char * | logpath = "/dtn/route/prophet/controller" | |||
) | [inline, static] |
Factory method (invoked instead of constructor).
Definition at line 98 of file ProphetController.h.
References actions(), bundles(), params(), and ProphetController().
Referenced by dtn::ProphetRouter::initialize().
Prophet::fwd_strategy_t dtn::ProphetController::fwd_strategy | ( | ) | const [inline] |
Definition at line 110 of file ProphetController.h.
References dtn::ProphetParams::fs_, and params_.
void dtn::ProphetController::set_fwd_strategy | ( | Prophet::fwd_strategy_t | f | ) | [inline] |
Definition at line 111 of file ProphetController.h.
References dtn::ProphetParams::fs_, and params_.
Prophet::q_policy_t dtn::ProphetController::q_policy | ( | ) | const [inline] |
Definition at line 113 of file ProphetController.h.
References params_, and dtn::ProphetParams::qp_.
void dtn::ProphetController::set_q_policy | ( | Prophet::q_policy_t | q | ) | [inline] |
Definition at line 114 of file ProphetController.h.
References params_, and dtn::ProphetParams::qp_.
void dtn::ProphetController::dump_state | ( | oasys::StringBuffer * | ) |
Snarf something intelligent from TableBasedRouter ?
Definition at line 104 of file ProphetController.cc.
References oasys::StringBuffer::appendf(), dtn::ProphetTable::begin(), encounters_, dtn::ProphetTable::end(), dtn::ProphetParams::fs_, dtn::Prophet::fs_to_str(), ExamineDump::l, dtn::ProphetTable::lock(), lock_, nodes_, params_, dtn::ProphetParams::qp_, dtn::Prophet::qp_to_str(), and dtn::ProphetTable::size().
Referenced by dtn::ProphetRouter::get_routing_state().
void dtn::ProphetController::handle_bundle_received | ( | Bundle * | , | |
const ContactRef & | ||||
) |
Prophet's handler for receiving all Bundles, including Prophet control messages (TLVs).
For TLVs, demux which ProphetEncounter to deliver to.
Definition at line 199 of file ProphetController.cc.
References actions_, bundles_, dtn::BundleActions::delete_bundle(), dtn::ProphetTLV::deserialize(), dtn::Bundle::dest_, dtn::Prophet::eid_to_routeid(), encounters_, dtn::EndpointID::equals(), dtn::ProphetTable::find(), find_instance(), ExamineDump::l, lock_, log_debug, log_err, new_neighbor(), nodes_, oasys::Ref< _Type >::object(), params_, prophet_eid_, dtn::ProphetBundleQueue::push(), dtn::BundleProtocol::REASON_NO_ADDTL_INFO, dtn::ProphetNode::set_eid(), and dtn::ProphetTable::update().
Referenced by dtn::ProphetRouter::handle_bundle_received().
void dtn::ProphetController::handle_bundle_expired | ( | Bundle * | ) |
Handler for bundle expired event.
Definition at line 281 of file ProphetController.cc.
References bundles_, dtn::ProphetBundleQueue::drop_bundle(), dtn::ProphetStats::drop_bundle(), oasys::Ref< _Type >::object(), and pstats_.
Referenced by dtn::ProphetRouter::handle_bundle_expired().
void dtn::ProphetController::handle_bundle_delivered | ( | Bundle * | ) |
Handler for bundle delivered event.
Definition at line 266 of file ProphetController.cc.
References acks_, bundles_, dtn::ProphetBundleQueue::drop_bundle(), dtn::ProphetAckList::insert(), and oasys::Ref< _Type >::object().
Referenced by dtn::ProphetRouter::handle_bundle_delivered().
void dtn::ProphetController::handle_link_state_change_request | ( | const ContactRef & | ) |
Handler for when a busy link becomes available.
Definition at line 296 of file ProphetController.cc.
References find_instance(), dtn::ProphetEncounter::flush_pending(), and oasys::Ref< _Type >::object().
Referenced by dtn::ProphetRouter::handle_link_state_change_request().
void dtn::ProphetController::new_neighbor | ( | const ContactRef & | ) |
New link has come up; attempt to establish contact.
Definition at line 164 of file ProphetController.cc.
References dtn::EndpointID::equals(), find_instance(), log_info, dtn::EndpointID::NULL_EID(), oasys::Ref< _Type >::object(), reg(), dtn::ProphetEncounter::remote_eid(), and oasys::Thread::start().
Referenced by handle_bundle_received(), and dtn::ProphetRouter::handle_contact_up().
void dtn::ProphetController::neighbor_gone | ( | const ContactRef & | ) |
Existing link has gone away; clean up state.
Definition at line 182 of file ProphetController.cc.
References find_instance(), log_info, and oasys::Ref< _Type >::object().
Referenced by dtn::ProphetRouter::handle_contact_down().
void dtn::ProphetController::handle_queue_policy_change | ( | Prophet::q_policy_t | qp | ) | [inline] |
Callback to handle queue policy change.
Definition at line 156 of file ProphetController.h.
References bundles_, dtn::Prophet::INVALID_QP, log_info, nodes_, params_, pstats_, dtn::ProphetParams::qp_, dtn::Prophet::qp_to_str(), dtn::QueueComp::queuecomp(), and dtn::ProphetBundleQueue::set_comp().
void dtn::ProphetController::handle_hello_interval_change | ( | u_int | hello_interval | ) | [inline] |
Callback to handle hello_interval change.
Definition at line 176 of file ProphetController.h.
References encounters_, dtn::ProphetParams::hello_interval_, log_info, and params_.
void dtn::ProphetController::handle_max_usage_change | ( | u_int | max_usage | ) | [inline] |
Callback to handle max_usage change.
Definition at line 200 of file ProphetController.h.
References bundles_, log_info, dtn::ProphetParams::max_usage_, params_, and oasys::BoundedPriorityQueue< T, TSize, TCompare >::set_max().
void dtn::ProphetController::shutdown | ( | ) |
Callback to shutdown ProphetEncounter threads prior to destructor.
Definition at line 85 of file ProphetController.cc.
References ack_age_timer_, oasys::Timer::cancel(), encounters_, ExamineDump::l, lock_, and node_age_timer_.
Referenced by dtn::ProphetRouter::~ProphetRouter().
ProphetParams* dtn::ProphetController::params | ( | ) | [inline, virtual] |
virtual from ProphetOracle
Implements dtn::ProphetOracle.
Definition at line 221 of file ProphetController.h.
References params_.
ProphetBundleQueue* dtn::ProphetController::bundles | ( | ) | [inline, virtual] |
virtual from ProphetOracle
Implements dtn::ProphetOracle.
Definition at line 222 of file ProphetController.h.
References bundles_.
Referenced by init().
ProphetTable* dtn::ProphetController::nodes | ( | ) | [inline, virtual] |
virtual from ProphetOracle
Implements dtn::ProphetOracle.
Definition at line 223 of file ProphetController.h.
References nodes_.
BundleActions* dtn::ProphetController::actions | ( | ) | [inline, virtual] |
virtual from ProphetOracle
Implements dtn::ProphetOracle.
Definition at line 224 of file ProphetController.h.
References actions_.
ProphetAckList* dtn::ProphetController::acks | ( | ) | [inline, virtual] |
virtual from ProphetOracle
Implements dtn::ProphetOracle.
Definition at line 225 of file ProphetController.h.
References acks_.
ProphetStats* dtn::ProphetController::stats | ( | ) | [inline, virtual] |
virtual from ProphetOracle
Implements dtn::ProphetOracle.
Definition at line 226 of file ProphetController.h.
References pstats_.
bool dtn::ProphetController::reg | ( | ProphetEncounter * | pe | ) | [inline] |
Definition at line 229 of file ProphetController.h.
References encounters_, ExamineDump::l, dtn::ProphetEncounter::local_instance(), lock_, and log_info.
Referenced by new_neighbor().
bool dtn::ProphetController::unreg | ( | ProphetEncounter * | pe | ) | [inline] |
Definition at line 239 of file ProphetController.h.
References encounters_, ExamineDump::l, dtn::ProphetEncounter::local_instance(), lock_, and log_info.
static bool dtn::ProphetController::is_init | ( | ) | [inline, static] |
double dtn::ProphetController::p_value | ( | Bundle * | ) | [protected] |
Look up and return the delivery predictability (p_value) for this Bundle.
ProphetEncounter * dtn::ProphetController::find_instance | ( | Link * | link | ) | [protected] |
Definition at line 146 of file ProphetController.cc.
References dtn::EndpointID::c_str(), encounters_, ExamineDump::l, lock_, log_debug, and dtn::Link::remote_eid().
Referenced by handle_bundle_received(), handle_link_state_change_request(), neighbor_gone(), and new_neighbor().
ProphetParams* dtn::ProphetController::params_ [protected] |
Prophet parameters, to share among ProphetEncounters.
Definition at line 265 of file ProphetController.h.
Referenced by do_init(), dump_state(), fwd_strategy(), handle_bundle_received(), handle_hello_interval_change(), handle_max_usage_change(), handle_queue_policy_change(), params(), q_policy(), set_fwd_strategy(), and set_q_policy().
enc_set dtn::ProphetController::encounters_ [protected] |
The collection of active sessions with other Prophet nodes.
Definition at line 270 of file ProphetController.h.
Referenced by dump_state(), find_instance(), handle_bundle_received(), handle_hello_interval_change(), ProphetController(), reg(), shutdown(), and unreg().
oasys::SpinLock* dtn::ProphetController::lock_ [protected] |
Control concurrent access to encounter list.
Definition at line 275 of file ProphetController.h.
Referenced by do_init(), dump_state(), find_instance(), handle_bundle_received(), reg(), shutdown(), unreg(), and ~ProphetController().
ProphetTable dtn::ProphetController::nodes_ [protected] |
Authoritative list of all Prophet nodes seen by local node.
Definition at line 280 of file ProphetController.h.
Referenced by do_init(), dump_state(), handle_bundle_received(), handle_queue_policy_change(), and nodes().
Applies aging algorithm to node table.
Definition at line 285 of file ProphetController.h.
Referenced by do_init(), shutdown(), and ~ProphetController().
ProphetAckAgeTimer* dtn::ProphetController::ack_age_timer_ [protected] |
Timer to effect Prophet ACK expiration.
Definition at line 290 of file ProphetController.h.
Referenced by do_init(), shutdown(), and ~ProphetController().
ProphetAckList dtn::ProphetController::acks_ [protected] |
All bundles ProphetRouter has ACKs for.
Definition at line 295 of file ProphetController.h.
Referenced by acks(), do_init(), and handle_bundle_delivered().
ProphetStats dtn::ProphetController::pstats_ [protected] |
Used to track various statistics for forwarding and queuing.
Definition at line 300 of file ProphetController.h.
Referenced by do_init(), handle_bundle_expired(), handle_queue_policy_change(), and stats().
BundleActions* dtn::ProphetController::actions_ [protected] |
Router's bundle action object.
Definition at line 305 of file ProphetController.h.
Referenced by actions(), do_init(), and handle_bundle_received().
ProphetBundleQueue* dtn::ProphetController::bundles_ [protected] |
Bounded Priority Queue with queuing policy ordering.
Definition at line 310 of file ProphetController.h.
Referenced by bundles(), do_init(), handle_bundle_delivered(), handle_bundle_expired(), handle_bundle_received(), handle_max_usage_change(), handle_queue_policy_change(), and ~ProphetController().
EndpointID dtn::ProphetController::prophet_eid_ [protected] |
EndpointID of this Prophet instance.
Definition at line 315 of file ProphetController.h.
Referenced by handle_bundle_received(), and ProphetController().