#include <BundleRouter.h>
It receives events from the BundleDaemon having been posted by other components. These events include all operations and occurrences that may affect bundle delivery, including new bundle arrival, contact arrival, timeouts, etc.
In response to each event the router may call one of the action functions implemented by the BundleDaemon. Note that to support the simulator environment, all interactions with the rest of the system should go through the singleton BundleAction classs.
To support prototyping of different routing protocols and frameworks, the base class has a list of prospective BundleRouter implementations, and at boot time, one of these is selected as the active routing algorithm. As new algorithms are added to the system, new cases should be added to the "create_router" function.
Definition at line 60 of file BundleRouter.h.
Public Member Functions | |
virtual | ~BundleRouter () |
Destructor. | |
virtual void | initialize () |
virtual void | handle_event (BundleEvent *event)=0 |
Pure virtual event handler function (copied from BundleEventHandler for clarity). | |
virtual bool | accept_bundle (Bundle *bundle, int *errp) |
Synchronous probe indicating whether or not this bundle should be accepted by the system. | |
virtual void | get_routing_state (oasys::StringBuffer *buf)=0 |
Format the given StringBuffer with current routing info. | |
virtual void | shutdown () |
for registration with the BundleDaemon | |
Static Public Member Functions | |
static BundleRouter * | create_router (const char *type) |
Factory method to create the correct subclass of BundleRouter for the registered algorithm type. | |
Static Public Attributes | |
static struct dtn::BundleRouter::Config | config_ |
Config variables. | |
Protected Member Functions | |
BundleRouter (const char *classname, const std::string &name) | |
Constructor. | |
Protected Attributes | |
std::string | name_ |
Name of this particular router. | |
BundleList * | pending_bundles_ |
The list of all bundles still pending delivery. | |
BundleList * | custody_bundles_ |
The list of all bundles that I have custody of. | |
BundleActions * | actions_ |
The actions interface, set by the BundleDaemon when the router is initialized. | |
Classes | |
struct | Config |
Config variables. More... |
dtn::BundleRouter::~BundleRouter | ( | ) | [virtual] |
dtn::BundleRouter::BundleRouter | ( | const char * | classname, | |
const std::string & | name | |||
) | [protected] |
Constructor.
Definition at line 82 of file BundleRouter.cc.
References actions_, custody_bundles_, oasys::Logger::logpathf(), and pending_bundles_.
BundleRouter * dtn::BundleRouter::create_router | ( | const char * | type | ) | [static] |
Factory method to create the correct subclass of BundleRouter for the registered algorithm type.
Definition at line 48 of file BundleRouter.cc.
References dtn::TcaRouter::TCA_GATEWAY, and dtn::TcaRouter::TCA_ROUTER.
Referenced by dtn::BundleDaemon::run().
void dtn::BundleRouter::initialize | ( | ) | [virtual] |
Reimplemented in dtn::LinkStateRouter, and dtn::ProphetRouter.
Definition at line 97 of file BundleRouter.cc.
Referenced by dtn::BundleDaemon::run().
virtual void dtn::BundleRouter::handle_event | ( | BundleEvent * | event | ) | [pure virtual] |
Pure virtual event handler function (copied from BundleEventHandler for clarity).
Implements dtn::BundleEventHandler.
Implemented in dtn::LinkStateRouter, dtn::ProphetRouter, and dtn::TableBasedRouter.
Referenced by dtnsim::GlueNode::forward_event(), and dtn::BundleDaemon::handle_event().
Synchronous probe indicating whether or not this bundle should be accepted by the system.
The default implementation checks if the bundle size will exceed the configured storage quota (if any).
Definition at line 108 of file BundleRouter.cc.
References dtn::BundlePayload::length(), log_info, dtn::Bundle::payload_, dtn::BundleStore::payload_quota(), dtn::BundleProtocol::REASON_DEPLETED_STORAGE, and dtn::BundleStore::total_size().
Referenced by dtn::BundleDaemon::handle_bundle_accept().
virtual void dtn::BundleRouter::get_routing_state | ( | oasys::StringBuffer * | buf | ) | [pure virtual] |
Format the given StringBuffer with current routing info.
Implemented in dtn::LinkStateRouter, dtn::ProphetRouter, and dtn::TableBasedRouter.
Referenced by dtn::BundleDaemon::get_routing_state().
void dtn::BundleRouter::shutdown | ( | ) | [virtual] |
Config variables.
These must be static since they're set by the config parser before any router objects are created.
Definition at line 44 of file BundleRouter.cc.
Referenced by dtn::TableBasedRouter::handle_link_created(), dtn::RouteCommand::RouteCommand(), dtn::RouteEntry::RouteEntry(), and dtn::BundleDaemon::run().
std::string dtn::BundleRouter::name_ [protected] |
Name of this particular router.
Definition at line 135 of file BundleRouter.h.
Referenced by dtn::TableBasedRouter::get_routing_state().
BundleList* dtn::BundleRouter::pending_bundles_ [protected] |
The list of all bundles still pending delivery.
Definition at line 138 of file BundleRouter.h.
Referenced by BundleRouter(), dtn::TableBasedRouter::check_next_hop(), and dtn::ProphetRouter::initialize().
BundleList* dtn::BundleRouter::custody_bundles_ [protected] |
The list of all bundles that I have custody of.
Definition at line 141 of file BundleRouter.h.
Referenced by BundleRouter().
BundleActions* dtn::BundleRouter::actions_ [protected] |
The actions interface, set by the BundleDaemon when the router is initialized.
Definition at line 145 of file BundleRouter.h.
Referenced by BundleRouter(), dtn::TableBasedRouter::fwd_to_nexthop(), dtn::LinkStateRouter::handle_bundle_received(), dtn::ProphetRouter::initialize(), and dtn::LinkStateRouter::send_announcement().