#include <BundleDaemon.h>
Inheritance diagram for dtn::BundleDaemon:
All events are queued and then forwarded to the active router module. The router then responds by calling various functions on the BundleActions class that it is given, which in turn effect all the operations.
Definition at line 72 of file BundleDaemon.h.
Public Types | |
typedef void(*) | ShutdownProc (void *args) |
Typedef for a shutdown procedure. | |
Public Member Functions | |
BundleDaemon () | |
Constructor. | |
virtual void | do_init () |
Virtual initialization function, overridden in the simulator to install the modified event queue (with no notifier) and the SimBundleActions class. | |
virtual void | post_event (BundleEvent *event, bool at_back=true) |
Virtual post_event function, overridden by the Node class in the simulator to use a modified event queue. | |
BundleRouter * | router () |
Returns the current bundle router. | |
BundleActions * | actions () |
Return the current actions handler. | |
ContactManager * | contactmgr () |
Accessor for the contact manager. | |
FragmentManager * | fragmentmgr () |
Accessor for the fragmentation manager. | |
const RegistrationTable * | reg_table () |
Accessor for the registration table. | |
BundleList * | pending_bundles () |
Accessor for the pending bundles list. | |
BundleList * | custody_bundles () |
Accessor for the custody bundles list. | |
void | get_routing_state (oasys::StringBuffer *buf) |
Format the given StringBuffer with current routing info. | |
void | get_bundle_stats (oasys::StringBuffer *buf) |
Format the given StringBuffer with the current bundle statistics. | |
void | get_daemon_stats (oasys::StringBuffer *buf) |
Format the given StringBuffer with the current internal statistics value. | |
void | reset_stats () |
Reset all internal stats. | |
const EndpointID & | local_eid () |
Return the local endpoint identifier. | |
void | set_local_eid (const char *eid_str) |
Set the local endpoint id. | |
void | set_app_shutdown (ShutdownProc proc, void *data) |
Set an application-specific shutdown handler. | |
Static Public Member Functions | |
static BundleDaemon * | instance () |
Singleton accessor. | |
static void | init () |
Boot time initializer. | |
static void | post (BundleEvent *event) |
Queues the event at the tail of the queue for processing by the daemon thread. | |
static void | post_at_head (BundleEvent *event) |
Queues the event at the head of the queue for processing by the daemon thread. | |
static bool | post_and_wait (BundleEvent *event, oasys::Notifier *notifier, int timeout=-1, bool at_back=true) |
Post the given event and wait for it to be processed by the daemon thread or for the given timeout to elapse. | |
Static Public Attributes | |
static Params | params_ |
Protected Types | |
typedef BundleProtocol::custody_signal_reason_t | custody_signal_reason_t |
typedef BundleProtocol::status_report_flag_t | status_report_flag_t |
typedef BundleProtocol::status_report_reason_t | status_report_reason_t |
Protected Member Functions | |
void | load_registrations () |
Initialize and load in the registrations. | |
void | load_bundles () |
Initialize and load in stored bundles. | |
void | run () |
Main thread function that dispatches events. | |
void | handle_event (BundleEvent *event) |
Main event handling function. | |
void | generate_status_report (Bundle *bundle, status_report_flag_t flag, status_report_reason_t reason=BundleProtocol::REASON_NO_ADDTL_INFO) |
Locally generate a status report for the given bundle. | |
void | generate_custody_signal (Bundle *bundle, bool succeeded, custody_signal_reason_t reason) |
Generate a custody signal to be sent to the current custodian. | |
void | cancel_custody_timers (Bundle *bundle) |
Cancel any pending custody timers for the bundle. | |
void | accept_custody (Bundle *bundle) |
Take custody for the given bundle, sending the appropriate signal to the current custodian. | |
void | release_custody (Bundle *bundle) |
Release custody of the given bundle, sending the appropriate signal to the current custodian. | |
bool | add_to_pending (Bundle *bundle, bool add_to_store) |
Add the bundle to the pending list and (optionally) the persistent store, and set up the expiration timer for it. | |
void | delete_from_pending (Bundle *bundle, status_report_reason_t reason) |
Remove the bundle from the pending list and data store, and cancel the expiration timer. | |
void | try_delete_from_pending (Bundle *bundle) |
Check if we should delete this bundle, called once it's been transmitted or delivered at least once. | |
Bundle * | find_duplicate (Bundle *bundle) |
Check if there are any bundles in the pending queue that match the source id, timestamp, and fragmentation offset/length fields. | |
void | deliver_to_registration (Bundle *bundle, Registration *registration) |
Deliver the bundle to the given registration. | |
void | check_registrations (Bundle *bundle) |
Check the registration table and deliver the bundle to any that match. | |
void | handle_bundle_received (BundleReceivedEvent *event) |
Event type specific handlers. | |
void | handle_bundle_transmitted (BundleTransmittedEvent *event) |
Event type specific handlers. | |
void | handle_bundle_transmit_failed (BundleTransmitFailedEvent *event) |
Event type specific handlers. | |
void | handle_bundle_delivered (BundleDeliveredEvent *event) |
Event type specific handlers. | |
void | handle_bundle_expired (BundleExpiredEvent *event) |
Event type specific handlers. | |
void | handle_bundle_free (BundleFreeEvent *event) |
Event type specific handlers. | |
void | handle_registration_added (RegistrationAddedEvent *event) |
Event type specific handlers. | |
void | handle_registration_removed (RegistrationRemovedEvent *event) |
Event type specific handlers. | |
void | handle_registration_expired (RegistrationExpiredEvent *event) |
Event type specific handlers. | |
void | handle_contact_up (ContactUpEvent *event) |
Event type specific handlers. | |
void | handle_contact_down (ContactDownEvent *event) |
Event type specific handlers. | |
void | handle_link_available (LinkAvailableEvent *event) |
Event type specific handlers. | |
void | handle_link_unavailable (LinkUnavailableEvent *event) |
Event type specific handlers. | |
void | handle_link_state_change_request (LinkStateChangeRequest *request) |
Event type specific handlers. | |
void | handle_reassembly_completed (ReassemblyCompletedEvent *event) |
Event type specific handlers. | |
void | handle_route_add (RouteAddEvent *event) |
Event type specific handlers. | |
void | handle_route_del (RouteDelEvent *event) |
Event type specific handlers. | |
void | handle_custody_signal (CustodySignalEvent *event) |
Event type specific handlers. | |
void | handle_custody_timeout (CustodyTimeoutEvent *event) |
Event type specific handlers. | |
void | handle_shutdown_request (ShutdownRequest *event) |
Event type specific handlers. | |
void | handle_status_request (StatusRequest *event) |
Event type specific handlers. | |
Protected Attributes | |
BundleRouter * | router_ |
The active bundle router. | |
BundleActions * | actions_ |
The active bundle actions handler. | |
AdminRegistration * | admin_reg_ |
The administrative registration. | |
ContactManager * | contactmgr_ |
The contact manager. | |
FragmentManager * | fragmentmgr_ |
The fragmentation / reassembly manager. | |
RegistrationTable * | reg_table_ |
The table of active registrations. | |
BundleList * | pending_bundles_ |
The list of all bundles still pending delivery. | |
BundleList * | custody_bundles_ |
The list of all bundles that we have custody of. | |
oasys::MsgQueue< BundleEvent * > * | eventq_ |
The event queue. | |
EndpointID | local_eid_ |
The default endpoint id for reaching this daemon, used for bundle status reports, routing, etc. | |
Stats | stats_ |
Stats instance. | |
ShutdownProc | app_shutdown_proc_ |
Application-specific shutdown handler. | |
void * | app_shutdown_data_ |
Application-specific shutdown data. | |
Static Protected Attributes | |
static BundleDaemon * | instance_ |
The static instance. | |
Classes | |
struct | Params |
General daemon parameters, initialized in ParamCommand. More... | |
struct | Stats |
Statistics structure definition. More... |
typedef void(*) dtn::BundleDaemon::ShutdownProc(void *args) |
typedef BundleProtocol::custody_signal_reason_t dtn::BundleDaemon::custody_signal_reason_t [protected] |
Definition at line 297 of file BundleDaemon.h.
typedef BundleProtocol::status_report_flag_t dtn::BundleDaemon::status_report_flag_t [protected] |
Definition at line 298 of file BundleDaemon.h.
typedef BundleProtocol::status_report_reason_t dtn::BundleDaemon::status_report_reason_t [protected] |
Definition at line 299 of file BundleDaemon.h.
dtn::BundleDaemon::BundleDaemon | ( | ) |
Constructor.
Definition at line 67 of file BundleDaemon.cc.
References app_shutdown_data_, app_shutdown_proc_, dtn::EndpointID::assign(), contactmgr_, custody_bundles_, fragmentmgr_, local_eid_, pending_bundles_, reg_table_, router_, and stats_.
Referenced by init().
static BundleDaemon* dtn::BundleDaemon::instance | ( | ) | [inline, static] |
Singleton accessor.
Definition at line 77 of file BundleDaemon.h.
References instance_.
Referenced by dtn::BundleRouter::BundleRouter(), dtn::TcaRouter::create_link(), dtn::Bundle::del_ref(), dtn::APIRegistration::deliver_bundle(), dtn::RouteCommand::exec(), dtn::RegistrationCommand::exec(), dtn::LinkCommand::exec(), dtn::BundleCommand::exec(), dtn::LinkStateRouter::flood_announcement(), dtn::CLConnection::handle_announce_bundle(), dtn::APIClient::handle_bind(), dtn::LinkStateRouter::handle_bundle_received(), dtn::LinkStateRouter::handle_contact_down(), dtn::LinkStateRouter::handle_contact_up(), dtn::APIClient::handle_find_registration(), dtn::APIClient::handle_local_eid(), dtn::APIClient::handle_unbind(), dtn::APIClient::handle_unregister(), dtn::LinkStateRouter::initialize(), dtn::StreamConvergenceLayer::Connection::initiate_contact(), dtn::BundleActions::inject_bundle(), dtn::TcaRouter::post_bundle(), dtn::BluetoothConvergenceLayer::Connection::recv_bundle(), dtn::BluetoothConvergenceLayer::NeighborDiscovery::send_announce(), dtn::BluetoothConvergenceLayer::Connection::send_announce(), dtn::LinkStateRouter::send_announcement(), dtn::DTNServer::set_app_shutdown(), dtn::DTNServer::shutdown(), dtn::DTNServer::start(), and dtn::TcaRouter::TcaRouter().
void dtn::BundleDaemon::do_init | ( | ) | [virtual] |
Virtual initialization function, overridden in the simulator to install the modified event queue (with no notifier) and the SimBundleActions class.
Reimplemented in dtnsim::Node.
Definition at line 92 of file BundleDaemon.cc.
References actions_, eventq_, and oasys::Logger::logpath_.
Referenced by init().
static void dtn::BundleDaemon::init | ( | ) | [inline, static] |
Boot time initializer.
Definition at line 99 of file BundleDaemon.h.
References BundleDaemon(), do_init(), and instance_.
Referenced by dtn::DTNServer::init_components().
void dtn::BundleDaemon::post | ( | BundleEvent * | event | ) | [static] |
Queues the event at the tail of the queue for processing by the daemon thread.
Definition at line 101 of file BundleDaemon.cc.
References instance_, and post_event().
Referenced by dtn::ContactManager::add_link(), dtn::CLConnection::break_contact(), dtn::BluetoothConvergenceLayer::Connection::break_contact(), dtn::CLConnection::close_contact(), dtn::APIClient::close_session(), dtn::CLConnection::contact_up(), dtn::ContactManager::del_link(), dtn::Bundle::del_ref(), dtn::LoggingRegistration::deliver_bundle(), dtn::LinkStateRouter::LSRegistration::deliver_bundle(), dtn::APIRegistration::deliver_bundle(), dtn::AdminRegistration::deliver_bundle(), dtn::RouteCommand::exec(), dtn::LinkCommand::exec(), dtn::BundleCommand::exec(), dtn::TclRegistration::get_bundle_data(), dtn::BluetoothConvergenceLayer::Connection::handle_ack(), dtn::StreamConvergenceLayer::Connection::handle_ack_segment(), dtn::StreamConvergenceLayer::Connection::handle_end_bundle(), dtn::TableBasedRouter::handle_link_created(), dtn::APIClient::handle_recv(), dtn::LinkStateRouter::initialize(), dtn::LinkStateRouter::LSRegistration::LSRegistration(), dtn::UDPConvergenceLayer::open_contact(), dtn::NullConvergenceLayer::open_contact(), post_and_wait(), dtn::TcaRouter::post_bundle(), dtn::FragmentManager::proactively_fragment(), dtn::CLConnection::process_command(), dtn::UDPConvergenceLayer::Receiver::process_data(), dtn::BluetoothConvergenceLayer::Connection::recv_bundle(), dtn::ContactManager::reopen_link(), dtn::FileConvergenceLayer::Scanner::run(), dtn::UDPConvergenceLayer::send_bundle(), dtn::NullConvergenceLayer::send_bundle(), dtn::FileConvergenceLayer::send_bundle(), dtn::BluetoothConvergenceLayer::Connection::send_bundle(), dtn::OndemandLink::set_initial_state(), dtn::AlwaysOnLink::set_initial_state(), dtn::Registration::ExpirationTimer::timeout(), and dtn::CustodyTimer::timeout().
void dtn::BundleDaemon::post_at_head | ( | BundleEvent * | event | ) | [static] |
Queues the event at the head of the queue for processing by the daemon thread.
Definition at line 108 of file BundleDaemon.cc.
References instance_, and post_event().
Referenced by handle_link_state_change_request(), handle_reassembly_completed(), post_and_wait(), dtn::FragmentManager::process_for_reassembly(), dtn::ExpirationTimer::timeout(), and dtn::FragmentManager::try_to_reactively_fragment().
bool dtn::BundleDaemon::post_and_wait | ( | BundleEvent * | event, | |
oasys::Notifier * | notifier, | |||
int | timeout = -1 , |
|||
bool | at_back = true | |||
) | [static] |
Post the given event and wait for it to be processed by the daemon thread or for the given timeout to elapse.
Definition at line 115 of file BundleDaemon.cc.
References ASSERT, post(), post_at_head(), dtn::BundleEvent::processed_notifier_, oasys::Thread::start_barrier_enabled(), and oasys::Notifier::wait().
Referenced by dtn::BluetoothConvergenceLayer::Connection::break_contact(), dtn::RouteCommand::exec(), dtn::RegistrationCommand::exec(), dtn::BundleCommand::exec(), dtn::BluetoothConvergenceLayer::Connection::handle_ack(), dtn::APIClient::handle_register(), dtn::APIClient::handle_send(), dtn::APIClient::handle_unregister(), dtn::BluetoothConvergenceLayer::Connection::send_loop(), and dtn::DTNServer::shutdown().
void dtn::BundleDaemon::post_event | ( | BundleEvent * | event, | |
bool | at_back = true | |||
) | [virtual] |
Virtual post_event function, overridden by the Node class in the simulator to use a modified event queue.
Definition at line 137 of file BundleDaemon.cc.
References eventq_, log_debug, and dtn::BundleEvent::type_str().
Referenced by post(), and post_at_head().
BundleRouter* dtn::BundleDaemon::router | ( | ) | [inline] |
Returns the current bundle router.
Reimplemented in dtnsim::Node.
Definition at line 139 of file BundleDaemon.h.
BundleActions* dtn::BundleDaemon::actions | ( | ) | [inline] |
Return the current actions handler.
Definition at line 148 of file BundleDaemon.h.
References actions_.
Referenced by dtn::BundleRouter::BundleRouter(), and dtnsim::GlueNode::forward_event().
ContactManager* dtn::BundleDaemon::contactmgr | ( | ) | [inline] |
Accessor for the contact manager.
Definition at line 153 of file BundleDaemon.h.
References contactmgr_.
Referenced by dtn::TcaRouter::create_link(), dtn::RouteCommand::exec(), dtn::LinkCommand::exec(), dtn::LinkStateRouter::flood_announcement(), dtn::CLConnection::handle_announce_bundle(), dtn::LinkStateRouter::handle_bundle_received(), dtnsim::Node::process(), dtn::BluetoothConvergenceLayer::Connection::recv_bundle(), and dtn::BluetoothConvergenceLayer::NeighborDiscovery::send_announce().
FragmentManager* dtn::BundleDaemon::fragmentmgr | ( | ) | [inline] |
Accessor for the fragmentation manager.
Definition at line 158 of file BundleDaemon.h.
References fragmentmgr_.
const RegistrationTable* dtn::BundleDaemon::reg_table | ( | ) | [inline] |
Accessor for the registration table.
Definition at line 163 of file BundleDaemon.h.
References reg_table_.
Referenced by dtn::RegistrationCommand::exec(), dtn::APIClient::handle_bind(), dtn::APIClient::handle_find_registration(), dtn::APIClient::handle_unbind(), and dtn::APIClient::handle_unregister().
BundleList* dtn::BundleDaemon::pending_bundles | ( | ) | [inline] |
Accessor for the pending bundles list.
Definition at line 168 of file BundleDaemon.h.
References pending_bundles_.
Referenced by dtn::BundleRouter::BundleRouter(), dtn::BundleCommand::exec(), get_bundle_stats(), and dtn::BundleActions::inject_bundle().
BundleList* dtn::BundleDaemon::custody_bundles | ( | ) | [inline] |
Accessor for the custody bundles list.
Definition at line 173 of file BundleDaemon.h.
References custody_bundles_.
Referenced by dtn::BundleRouter::BundleRouter(), and get_bundle_stats().
void dtn::BundleDaemon::get_routing_state | ( | oasys::StringBuffer * | buf | ) |
Format the given StringBuffer with current routing info.
Definition at line 146 of file BundleDaemon.cc.
References contactmgr_, dtn::ContactManager::dump(), dtn::BundleRouter::get_routing_state(), and router_.
Referenced by dtn::RouteCommand::exec().
void dtn::BundleDaemon::get_bundle_stats | ( | oasys::StringBuffer * | buf | ) |
Format the given StringBuffer with the current bundle statistics.
Definition at line 154 of file BundleDaemon.cc.
References oasys::StringBuffer::appendf(), dtn::BundleDaemon::Stats::bundles_delivered_, dtn::BundleDaemon::Stats::bundles_expired_, dtn::BundleDaemon::Stats::bundles_generated_, dtn::BundleDaemon::Stats::bundles_received_, dtn::BundleDaemon::Stats::bundles_transmitted_, custody_bundles(), dtn::BundleDaemon::Stats::duplicate_bundles_, pending_bundles(), and stats_.
Referenced by dtn::BundleCommand::exec().
void dtn::BundleDaemon::get_daemon_stats | ( | oasys::StringBuffer * | buf | ) |
Format the given StringBuffer with the current internal statistics value.
Definition at line 176 of file BundleDaemon.cc.
References oasys::StringBuffer::appendf(), eventq_, dtn::BundleDaemon::Stats::events_processed_, and stats_.
Referenced by dtn::BundleCommand::exec().
void dtn::BundleDaemon::reset_stats | ( | ) |
Reset all internal stats.
Definition at line 186 of file BundleDaemon.cc.
References contactmgr_, ExamineDump::l, dtn::ContactManager::links(), dtn::ContactManager::lock(), and stats_.
Referenced by dtn::BundleCommand::exec().
const EndpointID& dtn::BundleDaemon::local_eid | ( | ) | [inline] |
Return the local endpoint identifier.
Definition at line 200 of file BundleDaemon.h.
References local_eid_.
Referenced by dtnsim::NodeCommand::exec(), dtn::LinkStateRouter::handle_bundle_received(), dtn::StreamConvergenceLayer::Connection::initiate_contact(), dtn::TcaRouter::post_bundle(), dtn::BluetoothConvergenceLayer::Connection::send_announce(), and dtn::TcaRouter::TcaRouter().
void dtn::BundleDaemon::set_local_eid | ( | const char * | eid_str | ) | [inline] |
Set the local endpoint id.
Definition at line 205 of file BundleDaemon.h.
References dtn::EndpointID::assign(), and local_eid_.
Referenced by dtn::RouteCommand::exec(), and dtnsim::NodeCommand::exec().
void dtn::BundleDaemon::set_app_shutdown | ( | ShutdownProc | proc, | |
void * | data | |||
) | [inline] |
Set an application-specific shutdown handler.
Definition at line 243 of file BundleDaemon.h.
References app_shutdown_data_, and app_shutdown_proc_.
Referenced by dtn::DTNServer::set_app_shutdown().
void dtn::BundleDaemon::load_registrations | ( | ) | [protected] |
Initialize and load in the registrations.
Definition at line 1403 of file BundleDaemon.cc.
References admin_reg_, dtn::EVENTSRC_ADMIN, dtn::EVENTSRC_STORE, oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::get(), handle_event(), dtn::RegistrationStore::instance(), log_err, and oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::new_iterator().
Referenced by run().
void dtn::BundleDaemon::load_bundles | ( | ) | [protected] |
Initialize and load in stored bundles.
Definition at line 1432 of file BundleDaemon.cc.
References dtn::EVENTSRC_STORE, oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::get(), handle_event(), dtn::BundleStore::instance(), log_err, log_notice, and oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::new_iterator().
Referenced by run().
void dtn::BundleDaemon::run | ( | ) | [protected, virtual] |
Main thread function that dispatches events.
Implements oasys::Thread.
Definition at line 1461 of file BundleDaemon.cc.
References ASSERT, dtn::BundleTimestamp::check_local_clock(), dtn::BundleRouter::Config, dtn::BundleRouter::create_router(), oasys::Time::elapsed_ms(), eventq_, oasys::Time::get_time(), handle_event(), dtn::BundleRouter::initialize(), oasys::IOTIMEOUT, load_bundles(), load_registrations(), log_debug, log_err, log_warn, oasys::TimerSystem::notifier(), oasys::IO::poll_multiple(), router_, oasys::TimerSystem::run_expired_timers(), oasys::Thread::should_stop(), and dtn::BundleEvent::type_str().
void dtn::BundleDaemon::handle_event | ( | BundleEvent * | event | ) | [protected, virtual] |
Main event handling function.
Implements dtn::BundleEventHandler.
Definition at line 1388 of file BundleDaemon.cc.
References contactmgr_, dtn::BundleEvent::daemon_only_, dtn::BundleEventHandler::dispatch_event(), dtn::BundleDaemon::Stats::events_processed_, dtn::ContactManager::handle_event(), dtn::BundleRouter::handle_event(), router_, and stats_.
Referenced by generate_custody_signal(), generate_status_report(), load_bundles(), load_registrations(), dtnsim::Node::process_bundle_events(), and run().
void dtn::BundleDaemon::handle_bundle_received | ( | BundleReceivedEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 373 of file BundleDaemon.cc.
References accept_custody(), dtn::BundleDaemon::Params::accept_custody_, add_to_pending(), oasys::StringBuffer::appendf(), dtn::Bundle::bundleid_, dtn::BundleReceivedEvent::bundleref_, dtn::BundleDaemon::Stats::bundles_generated_, dtn::BundleDaemon::Stats::bundles_received_, dtn::BundleReceivedEvent::bytes_received_, dtn::EndpointID::c_str(), oasys::StringBuffer::c_str(), check_registrations(), dtn::BundlePayload::close_file(), dtn::FragmentManager::convert_to_fragment(), dtn::Bundle::creation_ts_, custody_bundles_, dtn::BundleProtocol::CUSTODY_REDUNDANT_RECEPTION, dtn::Bundle::custody_requested_, dtn::BundleEvent::daemon_only_, dtn::Bundle::dest_, dtn::BundleDaemon::Stats::duplicate_bundles_, dtn::EVENTSRC_ADMIN, dtn::EVENTSRC_APP, dtn::EVENTSRC_FRAGMENTATION, dtn::EVENTSRC_PEER, dtn::EVENTSRC_STORE, dtn::Bundle::expiration_, find_duplicate(), dtn::Bundle::format_verbose(), fragmentmgr_, generate_custody_signal(), generate_status_report(), dtn::BundleTimestamp::get_current_time(), dtn::BundlePayload::is_file_open(), dtn::BundlePayload::length(), dtn::Bundle::local_custody_, log_debug, oasys::LOG_DEBUG, oasys::Logger::log_enabled(), log_info, oasys::Logger::log_multiline(), log_notice, log_warn, NOTREACHED, oasys::Ref< _Type >::object(), params_, dtn::Bundle::payload_, dtn::BundleList::push_back(), dtn::Bundle::receive_rcpt_, dtn::BundleTimestamp::seconds_, dtn::BundleTimestamp::seqno_, dtn::Bundle::source_, dtn::BundleReceivedEvent::source_, stats_, and dtn::BundleProtocol::STATUS_RECEIVED.
void dtn::BundleDaemon::handle_bundle_transmitted | ( | BundleTransmittedEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 541 of file BundleDaemon.cc.
References ASSERT, dtn::Bundle::bundleid_, dtn::BundleTransmittedEvent::bundleref_, dtn::BundleDaemon::Stats::bundles_transmitted_, dtn::BundleTransmittedEvent::bytes_sent_, dtn::BundleTransmittedEvent::contact_, dtn::ForwardingInfo::custody_timer_, dtn::Bundle::custody_timers_, dtn::BundleProtocol::formatted_length(), dtn::Bundle::forward_rcpt_, fragmentmgr_, dtn::Bundle::fwdlog_, generate_status_report(), dtn::ForwardingLog::get_latest_entry(), dtn::Link::is_reliable(), dtn::Bundle::local_custody_, log_info, dtn::Link::name(), dtn::Link::nexthop(), oasys::Ref< _Type >::object(), params_, dtn::Link::reliable_, dtn::BundleTransmittedEvent::reliably_sent_, dtn::BundleDaemon::Params::retry_reliable_unacked_, dtn::ForwardingInfo::state_, dtn::Link::stats(), stats_, dtn::BundleProtocol::STATUS_FORWARDED, dtn::ForwardingInfo::timestamp_, dtn::ForwardingInfo::TRANSMIT_FAILED, dtn::ForwardingInfo::TRANSMITTED, try_delete_from_pending(), dtn::FragmentManager::try_to_reactively_fragment(), and dtn::ForwardingLog::update().
void dtn::BundleDaemon::handle_bundle_transmit_failed | ( | BundleTransmitFailedEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 653 of file BundleDaemon.cc.
References dtn::Bundle::bundleid_, dtn::BundleTransmitFailedEvent::bundleref_, dtn::BundleTransmitFailedEvent::contact_, dtn::Bundle::fwdlog_, log_info, oasys::Ref< _Type >::object(), dtn::ForwardingInfo::TRANSMIT_FAILED, and dtn::ForwardingLog::update().
void dtn::BundleDaemon::handle_bundle_delivered | ( | BundleDeliveredEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 679 of file BundleDaemon.cc.
References dtn::Bundle::bundleid_, dtn::BundleDeliveredEvent::bundleref_, dtn::BundleDaemon::Stats::bundles_delivered_, dtn::EndpointID::c_str(), dtn::Bundle::custodian_, dtn::BundleProtocol::CUSTODY_NO_ADDTL_INFO, dtn::Bundle::custody_requested_, dtn::Bundle::delivery_rcpt_, dtn::Registration::endpoint(), dtn::EndpointID::equals(), generate_custody_signal(), generate_status_report(), dtn::BundlePayload::length(), dtn::Bundle::local_custody_, log_info, dtn::EndpointID::NULL_EID(), oasys::Ref< _Type >::object(), dtn::Bundle::payload_, dtn::Registration::regid(), dtn::BundleDeliveredEvent::registration_, release_custody(), stats_, dtn::BundleProtocol::STATUS_DELIVERED, and try_delete_from_pending().
void dtn::BundleDaemon::handle_bundle_expired | ( | BundleExpiredEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 734 of file BundleDaemon.cc.
References ASSERT, dtn::BundleExpiredEvent::bundleref_, dtn::BundleDaemon::Stats::bundles_expired_, delete_from_pending(), dtn::Bundle::expiration_timer_, dtn::Bundle::local_custody_, log_info, oasys::Ref< _Type >::object(), dtn::BundleProtocol::REASON_LIFETIME_EXPIRED, release_custody(), and stats_.
void dtn::BundleDaemon::handle_bundle_free | ( | BundleFreeEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 1371 of file BundleDaemon.cc.
References actions_, ASSERT, dtn::BundleFreeEvent::bundle_, dtn::Bundle::in_datastore_, oasys::SpinLock::lock(), dtn::Bundle::lock_, dtn::Bundle::refcount(), and dtn::BundleActions::store_del().
void dtn::BundleDaemon::handle_registration_added | ( | RegistrationAddedEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 763 of file BundleDaemon.cc.
References dtn::RegistrationTable::add(), dtn::BundleList::begin(), dtn::EndpointID::c_str(), deliver_to_registration(), dtn::BundleList::end(), dtn::Registration::endpoint(), dtn::EVENTSRC_APP, ExamineDump::l, dtn::BundleList::lock(), log_err, log_info, dtn::EndpointIDPattern::match(), pending_bundles_, reg_table_, dtn::Registration::regid(), dtn::RegistrationAddedEvent::registration_, and dtn::RegistrationAddedEvent::source_.
void dtn::BundleDaemon::handle_registration_removed | ( | RegistrationRemovedEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 794 of file BundleDaemon.cc.
References dtn::EndpointID::c_str(), dtn::RegistrationTable::del(), dtn::Registration::endpoint(), log_err, log_info, reg_table_, dtn::Registration::regid(), and dtn::RegistrationRemovedEvent::registration_.
void dtn::BundleDaemon::handle_registration_expired | ( | RegistrationExpiredEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 811 of file BundleDaemon.cc.
References dtn::Registration::active(), dtn::RegistrationTable::del(), dtn::RegistrationTable::get(), log_err, log_info, reg_table_, dtn::Registration::regid(), dtn::RegistrationExpiredEvent::regid_, and dtn::Registration::set_expired().
void dtn::BundleDaemon::handle_contact_up | ( | ContactUpEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 979 of file BundleDaemon.cc.
References ASSERT, dtn::ContactUpEvent::contact_, log_info, oasys::Ref< _Type >::object(), and dtn::Link::OPEN.
void dtn::BundleDaemon::handle_contact_down | ( | ContactDownEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 992 of file BundleDaemon.cc.
References dtn::ContactDownEvent::contact_, log_info, oasys::Ref< _Type >::object(), dtn::ContactEvent::reason_, and dtn::ContactEvent::reason_to_str().
void dtn::BundleDaemon::handle_link_available | ( | LinkAvailableEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 838 of file BundleDaemon.cc.
References ASSERT, dtn::Link::isavailable(), dtn::LinkAvailableEvent::link_, and log_info.
void dtn::BundleDaemon::handle_link_unavailable | ( | LinkUnavailableEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 848 of file BundleDaemon.cc.
References ASSERT, dtn::Link::isavailable(), dtn::LinkUnavailableEvent::link_, and log_info.
void dtn::BundleDaemon::handle_link_state_change_request | ( | LinkStateChangeRequest * | request | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 858 of file BundleDaemon.cc.
References actions_, ASSERT, dtn::Link::AVAILABLE, dtn::Link::BUSY, dtn::BundleActions::close_link(), dtn::Link::CLOSED, dtn::Link::contact(), dtn::LinkStateChangeRequest::contact_, dtn::ContactEvent::IDLE, dtn::LinkStateChangeRequest::link_, log_err, log_info, log_warn, oasys::Ref< _Type >::object(), dtn::LinkStateChangeRequest::old_state_, dtn::Link::OPEN, dtn::BundleActions::open_link(), dtn::Link::OPENING, post_at_head(), dtn::ContactEvent::reason_, dtn::ContactEvent::reason_to_str(), dtn::Link::set_state(), dtn::Link::state(), dtn::LinkStateChangeRequest::state_, dtn::Link::state_to_str(), dtn::Link::UNAVAILABLE, and dtn::ContactEvent::UNBLOCKED.
void dtn::BundleDaemon::handle_reassembly_completed | ( | ReassemblyCompletedEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 1007 of file BundleDaemon.cc.
References dtn::ReassemblyCompletedEvent::bundle_, dtn::EVENTSRC_FRAGMENTATION, dtn::ReassemblyCompletedEvent::fragments_, log_info, oasys::Ref< _Type >::object(), dtn::BundleList::pop_front(), post_at_head(), and try_delete_from_pending().
void dtn::BundleDaemon::handle_route_add | ( | RouteAddEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 1027 of file BundleDaemon.cc.
References dtn::RouteAddEvent::entry_, and log_info.
void dtn::BundleDaemon::handle_route_del | ( | RouteDelEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 1034 of file BundleDaemon.cc.
References dtn::EndpointID::c_str(), dtn::RouteDelEvent::dest_, and log_info.
void dtn::BundleDaemon::handle_custody_signal | ( | CustodySignalEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 1041 of file BundleDaemon.cc.
References dtn::EndpointID::c_str(), custody_bundles_, dtn::BundleProtocol::CUSTODY_REDUNDANT_RECEPTION, dtn::CustodySignalEvent::data_, dtn::BundleList::find(), log_info, log_notice, log_warn, dtn::CustodySignal::data_t::orig_creation_tv_, dtn::CustodySignal::data_t::orig_source_eid_, dtn::CustodySignal::data_t::reason_, dtn::CustodySignal::reason_to_str(), release_custody(), dtn::BundleTimestamp::seconds_, dtn::BundleTimestamp::seqno_, dtn::CustodySignal::data_t::succeeded_, and try_delete_from_pending().
void dtn::BundleDaemon::handle_custody_timeout | ( | CustodyTimeoutEvent * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 1086 of file BundleDaemon.cc.
References dtn::ForwardingLog::add_entry(), ASSERT, dtn::CustodyTimeoutEvent::bundle_, oasys::Timer::cancelled(), dtn::BundleList::contains(), dtn::ForwardingInfo::CUSTODY_TIMEOUT, dtn::Bundle::custody_timers_, dtn::CustodyTimerSpec::defaults_, dtn::Bundle::fwdlog_, dtn::ForwardingInfo::INVALID_ACTION, ExamineDump::l, dtn::CustodyTimer::link_, dtn::CustodyTimeoutEvent::link_, dtn::Bundle::lock_, log_err, log_info, dtn::Link::nexthop(), oasys::Ref< _Type >::object(), oasys::Timer::pending(), and pending_bundles_.
void dtn::BundleDaemon::handle_shutdown_request | ( | ShutdownRequest * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 1147 of file BundleDaemon.cc.
References app_shutdown_data_, app_shutdown_proc_, dtn::Link::close(), contactmgr_, dtn::Link::isopen(), ExamineDump::l, dtn::ContactManager::links(), dtn::ContactManager::lock(), log_debug, log_notice, and oasys::Thread::set_should_stop().
void dtn::BundleDaemon::handle_status_request | ( | StatusRequest * | event | ) | [protected, virtual] |
Event type specific handlers.
Reimplemented from dtn::BundleEventHandler.
Definition at line 1183 of file BundleDaemon.cc.
References log_info.
void dtn::BundleDaemon::generate_status_report | ( | Bundle * | bundle, | |
status_report_flag_t | flag, | |||
status_report_reason_t | reason = BundleProtocol::REASON_NO_ADDTL_INFO | |||
) | [protected] |
Locally generate a status report for the given bundle.
Definition at line 201 of file BundleDaemon.cc.
References dtn::BundleStatusReport::create_status_report(), dtn::EVENTSRC_ADMIN, handle_event(), dtn::BundlePayload::length(), local_eid_, log_debug, and dtn::Bundle::payload_.
Referenced by accept_custody(), delete_from_pending(), handle_bundle_delivered(), handle_bundle_received(), and handle_bundle_transmitted().
void dtn::BundleDaemon::generate_custody_signal | ( | Bundle * | bundle, | |
bool | succeeded, | |||
custody_signal_reason_t | reason | |||
) | [protected] |
Generate a custody signal to be sent to the current custodian.
Definition at line 218 of file BundleDaemon.cc.
References dtn::CustodySignal::create_custody_signal(), dtn::Bundle::custodian_, dtn::EndpointID::equals(), dtn::EVENTSRC_ADMIN, handle_event(), dtn::BundlePayload::length(), dtn::Bundle::local_custody_, local_eid_, log_err, dtn::EndpointID::NULL_EID(), and dtn::Bundle::payload_.
Referenced by accept_custody(), handle_bundle_delivered(), and handle_bundle_received().
void dtn::BundleDaemon::cancel_custody_timers | ( | Bundle * | bundle | ) | [protected] |
Cancel any pending custody timers for the bundle.
Definition at line 243 of file BundleDaemon.cc.
References dtn::Bundle::custody_timers_, ExamineDump::l, dtn::Bundle::lock_, and log_crit.
Referenced by release_custody().
void dtn::BundleDaemon::accept_custody | ( | Bundle * | bundle | ) | [protected] |
Take custody for the given bundle, sending the appropriate signal to the current custodian.
Definition at line 267 of file BundleDaemon.cc.
References actions_, dtn::EndpointID::assign(), dtn::Bundle::custodian_, custody_bundles_, dtn::BundleProtocol::CUSTODY_NO_ADDTL_INFO, dtn::Bundle::custody_rcpt_, dtn::EndpointID::equals(), generate_custody_signal(), generate_status_report(), dtn::Bundle::local_custody_, local_eid_, log_err, log_info, dtn::EndpointID::NULL_EID(), dtn::BundleList::push_back(), dtn::BundleProtocol::STATUS_CUSTODY_ACCEPTED, and dtn::BundleActions::store_update().
Referenced by handle_bundle_received().
void dtn::BundleDaemon::release_custody | ( | Bundle * | bundle | ) | [protected] |
Release custody of the given bundle, sending the appropriate signal to the current custodian.
Definition at line 307 of file BundleDaemon.cc.
References actions_, dtn::EndpointID::assign(), cancel_custody_timers(), dtn::Bundle::custodian_, custody_bundles_, dtn::BundleList::erase(), dtn::Bundle::local_custody_, log_err, log_info, dtn::EndpointID::NULL_EID(), and dtn::BundleActions::store_update().
Referenced by handle_bundle_delivered(), handle_bundle_expired(), and handle_custody_signal().
Add the bundle to the pending list and (optionally) the persistent store, and set up the expiration timer for it.
Definition at line 1191 of file BundleDaemon.cc.
References actions_, dtn::Bundle::bundleid_, dtn::Bundle::creation_ts_, dtn::Bundle::expiration_, dtn::Bundle::expiration_timer_, dtnsim::gettimeofday(), dtn::Bundle::in_datastore_, log_debug, log_warn, pending_bundles_, dtn::BundleList::push_back(), oasys::Timer::schedule_at(), dtn::BundleTimestamp::seconds_, dtn::BundleTimestamp::seqno_, dtn::BundleActions::store_add(), and dtn::BundleTimestamp::TIMEVAL_CONVERSION.
Referenced by handle_bundle_received().
void dtn::BundleDaemon::delete_from_pending | ( | Bundle * | bundle, | |
status_report_reason_t | reason | |||
) | [protected] |
Remove the bundle from the pending list and data store, and cancel the expiration timer.
Definition at line 1243 of file BundleDaemon.cc.
References dtn::Bundle::bundleid_, dtn::ExpirationTimer::bundleref_, oasys::Timer::cancel(), dtn::Bundle::deletion_rcpt_, dtn::BundleList::erase(), dtn::Bundle::expiration_timer_, generate_status_report(), log_crit, log_debug, log_err, pending_bundles_, dtn::BundleProtocol::REASON_NO_ADDTL_INFO, oasys::Ref< _Type >::release(), and dtn::BundleProtocol::STATUS_DELETED.
Referenced by handle_bundle_expired(), and try_delete_from_pending().
void dtn::BundleDaemon::try_delete_from_pending | ( | Bundle * | bundle | ) | [protected] |
Check if we should delete this bundle, called once it's been transmitted or delivered at least once.
If so, call delete_from_pending.
Definition at line 1281 of file BundleDaemon.cc.
References delete_from_pending(), dtn::BundleDaemon::Params::early_deletion_, dtn::Bundle::expiration_timer_, dtn::Bundle::fwdlog_, dtn::ForwardingLog::get_count(), dtn::ForwardingInfo::IN_FLIGHT, dtn::Bundle::is_queued_on(), log_debug, log_err, dtn::Bundle::num_mappings(), params_, pending_bundles_, and dtn::BundleProtocol::REASON_NO_ADDTL_INFO.
Referenced by handle_bundle_delivered(), handle_bundle_transmitted(), handle_custody_signal(), and handle_reassembly_completed().
Check if there are any bundles in the pending queue that match the source id, timestamp, and fragmentation offset/length fields.
Definition at line 1343 of file BundleDaemon.cc.
References dtn::BundleList::begin(), dtn::Bundle::creation_ts_, dtn::BundleList::end(), dtn::EndpointID::equals(), dtn::Bundle::frag_offset_, dtn::Bundle::is_fragment_, ExamineDump::l, dtn::BundlePayload::length(), dtn::BundleList::lock(), dtn::Bundle::orig_length_, dtn::Bundle::payload_, pending_bundles_, dtn::BundleTimestamp::seconds_, dtn::BundleTimestamp::seqno_, and dtn::Bundle::source_.
Referenced by handle_bundle_received().
void dtn::BundleDaemon::deliver_to_registration | ( | Bundle * | bundle, | |
Registration * | registration | |||
) | [protected] |
Deliver the bundle to the given registration.
Definition at line 328 of file BundleDaemon.cc.
References dtn::EndpointID::c_str(), dtn::Registration::deliver_bundle(), dtn::Registration::endpoint(), fragmentmgr_, dtn::Bundle::is_fragment_, log_debug, dtn::Bundle::owner_, dtn::FragmentManager::process_for_reassembly(), and dtn::Registration::regid().
Referenced by check_registrations(), and handle_registration_added().
void dtn::BundleDaemon::check_registrations | ( | Bundle * | bundle | ) | [protected] |
Check the registration table and deliver the bundle to any that match.
Definition at line 354 of file BundleDaemon.cc.
References deliver_to_registration(), dtn::Bundle::dest_, dtn::RegistrationTable::get_matching(), log_debug, and reg_table_.
Referenced by handle_bundle_received().
Definition at line 233 of file BundleDaemon.h.
Referenced by handle_bundle_received(), handle_bundle_transmitted(), dtn::ParamCommand::ParamCommand(), and try_delete_from_pending().
BundleRouter* dtn::BundleDaemon::router_ [protected] |
The active bundle router.
Reimplemented in dtnsim::GlueNode.
Definition at line 373 of file BundleDaemon.h.
Referenced by BundleDaemon(), dtnsim::Node::do_init(), get_routing_state(), handle_event(), dtnsim::Node::router(), router(), and run().
BundleActions* dtn::BundleDaemon::actions_ [protected] |
The active bundle actions handler.
Definition at line 376 of file BundleDaemon.h.
Referenced by accept_custody(), actions(), add_to_pending(), dtnsim::Node::do_init(), do_init(), handle_bundle_free(), handle_link_state_change_request(), and release_custody().
AdminRegistration* dtn::BundleDaemon::admin_reg_ [protected] |
The administrative registration.
Definition at line 379 of file BundleDaemon.h.
Referenced by load_registrations().
ContactManager* dtn::BundleDaemon::contactmgr_ [protected] |
The contact manager.
Definition at line 382 of file BundleDaemon.h.
Referenced by BundleDaemon(), contactmgr(), get_routing_state(), handle_event(), handle_shutdown_request(), dtnsim::Node::process(), and reset_stats().
FragmentManager* dtn::BundleDaemon::fragmentmgr_ [protected] |
The fragmentation / reassembly manager.
Definition at line 385 of file BundleDaemon.h.
Referenced by BundleDaemon(), deliver_to_registration(), fragmentmgr(), handle_bundle_received(), and handle_bundle_transmitted().
RegistrationTable* dtn::BundleDaemon::reg_table_ [protected] |
The table of active registrations.
Definition at line 388 of file BundleDaemon.h.
Referenced by BundleDaemon(), check_registrations(), handle_registration_added(), handle_registration_expired(), handle_registration_removed(), and reg_table().
BundleList* dtn::BundleDaemon::pending_bundles_ [protected] |
The list of all bundles still pending delivery.
Definition at line 391 of file BundleDaemon.h.
Referenced by add_to_pending(), BundleDaemon(), delete_from_pending(), find_duplicate(), handle_custody_timeout(), handle_registration_added(), pending_bundles(), and try_delete_from_pending().
BundleList* dtn::BundleDaemon::custody_bundles_ [protected] |
The list of all bundles that we have custody of.
Definition at line 394 of file BundleDaemon.h.
Referenced by accept_custody(), BundleDaemon(), custody_bundles(), handle_bundle_received(), handle_custody_signal(), and release_custody().
oasys::MsgQueue<BundleEvent*>* dtn::BundleDaemon::eventq_ [protected] |
The event queue.
Reimplemented in dtnsim::Node.
Definition at line 397 of file BundleDaemon.h.
Referenced by do_init(), get_daemon_stats(), post_event(), and run().
EndpointID dtn::BundleDaemon::local_eid_ [protected] |
The default endpoint id for reaching this daemon, used for bundle status reports, routing, etc.
Definition at line 401 of file BundleDaemon.h.
Referenced by accept_custody(), BundleDaemon(), generate_custody_signal(), generate_status_report(), local_eid(), and set_local_eid().
Stats dtn::BundleDaemon::stats_ [protected] |
Stats instance.
Definition at line 415 of file BundleDaemon.h.
Referenced by BundleDaemon(), get_bundle_stats(), get_daemon_stats(), handle_bundle_delivered(), handle_bundle_expired(), handle_bundle_received(), handle_bundle_transmitted(), handle_event(), and reset_stats().
ShutdownProc dtn::BundleDaemon::app_shutdown_proc_ [protected] |
Application-specific shutdown handler.
Definition at line 418 of file BundleDaemon.h.
Referenced by BundleDaemon(), handle_shutdown_request(), and set_app_shutdown().
void* dtn::BundleDaemon::app_shutdown_data_ [protected] |
Application-specific shutdown data.
Definition at line 421 of file BundleDaemon.h.
Referenced by BundleDaemon(), handle_shutdown_request(), and set_app_shutdown().
BundleDaemon * dtn::BundleDaemon::instance_ [static, protected] |
The static instance.
Definition at line 424 of file BundleDaemon.h.
Referenced by dtnsim::Node::active_node(), init(), instance(), post(), post_at_head(), and dtnsim::Node::set_active().