#include <Controller.h>
Public Types | |
typedef std::list< Encounter * > | List |
Public Member Functions | |
Controller (BundleCore *core, Repository *repository, ProphetParams *params) | |
Constructor. | |
virtual | ~Controller () |
Destructor. | |
void | new_neighbor (const Link *link) |
Signal Prophet that a new neighbor has been discovered. | |
void | neighbor_gone (const Link *link) |
Signal Prophet that contact with neighbor is lost. | |
bool | accept_bundle (const Bundle *bundle) |
Query whether Bundle should be accepted. | |
void | handle_bundle_received (const Bundle *b, const Link *link) |
Add Bundle to Prophet storage. | |
void | handle_bundle_transmitted (const Bundle *b, const Link *link) |
Update Prophet statistics on successful transmission. | |
void | ack (const Bundle *b) |
Add Prophet ACK for bundle. | |
void | set_queue_policy () |
Set Prophet's storage policy (query params_ for change). | |
void | set_hello_interval () |
Set Hello interval (longest acceptable delay in peering; query params_ for change). | |
void | set_max_route () |
Callback for runtime changes made to ProphetParams::max_table_size_. | |
void | shutdown () |
Callback for host system to notify of shutdown event. | |
void | handle_timeout () |
Virtual from ExpirationHandler. | |
const ProphetParams * | params () const |
virtual from Oracle | |
Stats * | stats () |
virtual from Oracle | |
Table * | nodes () |
virtual from Oracle | |
AckList * | acks () |
virtual from Oracle | |
BundleCore * | core () |
virtual from Oracle | |
const List::const_iterator | begin () const |
Iterators over Encounter list ... not thread safe. | |
const List::const_iterator | end () const |
Iterators over Encounter list ... not thread safe. | |
size_t | size () |
Accessors. | |
bool | empty () |
Accessors. | |
Protected Member Functions | |
bool | find (const Link *link, List::iterator &i) |
Search for Encounter based on Link properties. | |
bool | is_prophet_control (const Bundle *b) const |
Check Bundle destination for Prophet node endpoint ID. | |
Protected Attributes | |
BundleCore * | core_ |
facade interface for interacting with Bundle host | |
ProphetParams * | params_ |
tuneable parameter struct | |
Stats | stats_ |
forwarding statistics per bundle, used by queue policy | |
u_int | max_route_ |
upper limit to number of routes retained by Prophet | |
Table | nodes_ |
table of routes learned by local node | |
AckList | acks_ |
Prophet ack's for successfully delivered bundles. | |
u_int16_t | next_instance_ |
used to generate serial number for Encounters | |
Alarm * | alarm_ |
timeout handler for aging Nodes and Acks | |
u_int | timeout_ |
protocol timeout value (mirrors params_->hello_interval_) | |
Repository * | repository_ |
Prophet's queue policy enforcement. | |
List | list_ |
active Prophet peering sessions |
Definition at line 33 of file Controller.h.
typedef std::list<Encounter*> prophet::Controller::List |
Definition at line 37 of file Controller.h.
prophet::Controller::Controller | ( | BundleCore * | core, | |
Repository * | repository, | |||
ProphetParams * | params | |||
) |
Constructor.
Definition at line 28 of file Controller.cc.
References alarm_, core_, prophet::BundleCore::create_alarm(), prophet::Repository::get_comparator(), LOG, max_route_, prophet::ProphetParams::max_table_size_, prophet::ProphetParams::min_forward(), nodes_, params_, prophet::QueuePolicy::policy(), prophet::ProphetParams::qp(), prophet::QueueComp::qp(), repository_, prophet::Repository::set_comparator(), prophet::Table::set_max_route(), stats_, and timeout_.
prophet::Controller::~Controller | ( | ) | [virtual] |
Query whether Bundle should be accepted.
Definition at line 152 of file Controller.cc.
References core_, prophet::Bundle::destination_id(), prophet::BundleCore::is_route(), prophet::BundleCore::local_eid(), LOG, params_, prophet::ProphetParams::relay_node(), prophet::Bundle::sequence_num(), and prophet::Bundle::source_id().
Referenced by dtn::ProphetRouter::accept_bundle().
void prophet::Controller::ack | ( | const Bundle * | b | ) | [virtual] |
Add Prophet ACK for bundle.
Reimplemented from prophet::Oracle.
Definition at line 269 of file Controller.cc.
References is_prophet_control(), LOG, and prophet::Bundle::sequence_num().
Referenced by dtn::ProphetRouter::handle_bundle_delivered().
AckList* prophet::Controller::acks | ( | ) | [inline, virtual] |
virtual from Oracle
Implements prophet::Oracle.
Definition at line 106 of file Controller.h.
References acks_.
Referenced by dtn::ProphetRouter::get_routing_state().
const List::const_iterator prophet::Controller::begin | ( | ) | const [inline] |
Iterators over Encounter list ... not thread safe.
Definition at line 111 of file Controller.h.
References list_.
Referenced by dtn::ProphetRouter::get_routing_state().
BundleCore* prophet::Controller::core | ( | ) | [inline, virtual] |
virtual from Oracle
Implements prophet::Oracle.
Definition at line 107 of file Controller.h.
References core_.
Referenced by handle_bundle_transmitted().
bool prophet::Controller::empty | ( | ) | [inline] |
const List::const_iterator prophet::Controller::end | ( | ) | const [inline] |
Iterators over Encounter list ... not thread safe.
Definition at line 112 of file Controller.h.
References list_.
Referenced by dtn::ProphetRouter::get_routing_state().
Search for Encounter based on Link properties.
Definition at line 74 of file Controller.cc.
References list_.
Referenced by handle_bundle_received(), neighbor_gone(), and new_neighbor().
Add Bundle to Prophet storage.
Definition at line 176 of file Controller.cc.
References buf, core_, prophet::ProphetTLV::deserialize(), prophet::Bundle::destination_id(), prophet::BundleCore::drop_bundle(), find(), prophet::Encounter::handle_bundle_received(), is_prophet_control(), len, list_, prophet::Encounter::local_instance(), LOG, prophet::Encounter::neighbor_gone(), prophet::BundleCore::read_bundle(), prophet::Encounter::receive_tlv(), prophet::Link::remote_eid(), prophet::Bundle::sequence_num(), prophet::Bundle::size(), and prophet::Bundle::source_id().
Referenced by dtn::ProphetRouter::handle_bundle_received().
Update Prophet statistics on successful transmission.
Definition at line 255 of file Controller.cc.
References prophet::Repository::change_priority(), core(), prophet::BundleCore::drop_bundle(), is_prophet_control(), nodes_, prophet::Table::p_value(), prophet::Link::remote_eid(), repository_, stats_, and prophet::Stats::update_stats().
Referenced by dtn::ProphetRouter::handle_bundle_transmitted().
void prophet::Controller::handle_timeout | ( | ) | [virtual] |
Virtual from ExpirationHandler.
Implements prophet::ExpirationHandler.
Definition at line 324 of file Controller.cc.
References acks_, prophet::Table::age_nodes(), alarm_, core_, prophet::BundleCore::create_alarm(), prophet::ProphetParams::epsilon(), prophet::AckList::expire(), list_, LOG, nodes_, params_, timeout_, and prophet::Table::truncate().
Check Bundle destination for Prophet node endpoint ID.
Definition at line 88 of file Controller.cc.
References prophet::Bundle::destination_id().
Referenced by ack(), handle_bundle_received(), and handle_bundle_transmitted().
void prophet::Controller::neighbor_gone | ( | const Link * | link | ) |
Signal Prophet that contact with neighbor is lost.
Definition at line 135 of file Controller.cc.
References find(), list_, LOG, and prophet::Link::remote_eid().
Referenced by dtn::ProphetRouter::handle_contact_down().
void prophet::Controller::new_neighbor | ( | const Link * | link | ) |
Signal Prophet that a new neighbor has been discovered.
Definition at line 98 of file Controller.cc.
References find(), list_, prophet::Encounter::local_instance(), LOG, prophet::Encounter::neighbor_gone(), NEXT_INSTANCE, and prophet::Link::remote_eid().
Referenced by dtn::ProphetRouter::handle_contact_up().
Table* prophet::Controller::nodes | ( | ) | [inline, virtual] |
virtual from Oracle
Implements prophet::Oracle.
Definition at line 105 of file Controller.h.
References nodes_.
Referenced by dtn::ProphetRouter::get_routing_state(), and dtn::ProphetRouter::initialize().
const ProphetParams* prophet::Controller::params | ( | ) | const [inline, virtual] |
virtual from Oracle
Implements prophet::Oracle.
Definition at line 103 of file Controller.h.
References params_.
void prophet::Controller::set_hello_interval | ( | ) |
Set Hello interval (longest acceptable delay in peering; query params_ for change).
Definition at line 298 of file Controller.cc.
References prophet::ProphetParams::hello_interval_, list_, LOG, params_, and timeout_.
Referenced by dtn::ProphetRouter::set_hello_interval().
void prophet::Controller::set_max_route | ( | ) |
Callback for runtime changes made to ProphetParams::max_table_size_.
Definition at line 313 of file Controller.cc.
References LOG, max_route_, prophet::ProphetParams::max_table_size_, nodes_, params_, and prophet::Table::set_max_route().
Referenced by dtn::ProphetRouter::set_max_route().
void prophet::Controller::set_queue_policy | ( | ) |
Set Prophet's storage policy (query params_ for change).
Definition at line 279 of file Controller.cc.
References prophet::Repository::get_comparator(), LOG, prophet::ProphetParams::min_forward(), prophet::QueueComp::min_fwd_, nodes_, params_, prophet::QueuePolicy::policy(), prophet::ProphetParams::qp(), prophet::QueueComp::qp(), prophet::QueuePolicy::qp_to_str(), repository_, prophet::Repository::set_comparator(), and stats_.
Referenced by dtn::ProphetRouter::set_queue_policy().
void prophet::Controller::shutdown | ( | ) |
Callback for host system to notify of shutdown event.
Definition at line 351 of file Controller.cc.
References alarm_, prophet::Alarm::cancel(), list_, LOG, and prophet::Alarm::pending().
Referenced by dtn::ProphetRouter::shutdown().
size_t prophet::Controller::size | ( | ) | [inline] |
Accessors.
Definition at line 116 of file Controller.h.
References list_.
Referenced by dtn::ProphetRouter::get_routing_state().
Stats* prophet::Controller::stats | ( | ) | [inline, virtual] |
virtual from Oracle
Implements prophet::Oracle.
Definition at line 104 of file Controller.h.
References stats_.
Referenced by dtn::ProphetRouter::handle_bundle_expired().
AckList prophet::Controller::acks_ [protected] |
Prophet ack's for successfully delivered bundles.
Definition at line 142 of file Controller.h.
Referenced by acks(), and handle_timeout().
Alarm* prophet::Controller::alarm_ [protected] |
timeout handler for aging Nodes and Acks
Definition at line 145 of file Controller.h.
Referenced by Controller(), handle_timeout(), and shutdown().
BundleCore* prophet::Controller::core_ [protected] |
facade interface for interacting with Bundle host
Definition at line 137 of file Controller.h.
Referenced by accept_bundle(), Controller(), core(), handle_bundle_received(), and handle_timeout().
List prophet::Controller::list_ [protected] |
active Prophet peering sessions
Definition at line 149 of file Controller.h.
Referenced by begin(), empty(), end(), find(), handle_bundle_received(), handle_timeout(), neighbor_gone(), new_neighbor(), set_hello_interval(), shutdown(), size(), and ~Controller().
u_int prophet::Controller::max_route_ [protected] |
upper limit to number of routes retained by Prophet
Definition at line 140 of file Controller.h.
Referenced by Controller(), and set_max_route().
u_int16_t prophet::Controller::next_instance_ [protected] |
used to generate serial number for Encounters
Definition at line 143 of file Controller.h.
Table prophet::Controller::nodes_ [protected] |
table of routes learned by local node
Definition at line 141 of file Controller.h.
Referenced by Controller(), handle_bundle_transmitted(), handle_timeout(), nodes(), set_max_route(), and set_queue_policy().
ProphetParams* prophet::Controller::params_ [protected] |
tuneable parameter struct
Definition at line 138 of file Controller.h.
Referenced by accept_bundle(), Controller(), handle_timeout(), params(), set_hello_interval(), set_max_route(), and set_queue_policy().
Repository* prophet::Controller::repository_ [protected] |
Prophet's queue policy enforcement.
Definition at line 148 of file Controller.h.
Referenced by Controller(), handle_bundle_transmitted(), and set_queue_policy().
Stats prophet::Controller::stats_ [protected] |
forwarding statistics per bundle, used by queue policy
Definition at line 139 of file Controller.h.
Referenced by Controller(), handle_bundle_transmitted(), set_queue_policy(), and stats().
u_int prophet::Controller::timeout_ [protected] |
protocol timeout value (mirrors params_->hello_interval_)
Definition at line 146 of file Controller.h.
Referenced by Controller(), handle_timeout(), and set_hello_interval().