#include <BundleRouter.h>
Inheritance diagram for dtn::BundleRouter:
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 81 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 void | get_routing_state (oasys::StringBuffer *buf)=0 |
Format the given StringBuffer with current routing info. | |
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_t | Config |
Config defaults are set in RouteCommand.cc. | |
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_t |
Config variables. More... |
dtn::BundleRouter::~BundleRouter | ( | ) | [virtual] |
dtn::BundleRouter::BundleRouter | ( | const char * | classname, | |
const std::string & | name | |||
) | [protected] |
Constructor.
Definition at line 94 of file BundleRouter.cc.
References dtn::BundleDaemon::actions(), actions_, dtn::BundleDaemon::custody_bundles(), custody_bundles_, dtn::BundleDaemon::instance(), oasys::Logger::logpathf(), dtn::BundleDaemon::pending_bundles(), 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 63 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.
Definition at line 112 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, and dtn::TableBasedRouter.
Referenced by dtnsim::GlueNode::forward_event(), and dtn::BundleDaemon::handle_event().
virtual void dtn::BundleRouter::get_routing_state | ( | oasys::StringBuffer * | buf | ) | [pure virtual] |
Format the given StringBuffer with current routing info.
Implemented in dtn::LinkStateRouter, and dtn::TableBasedRouter.
Referenced by dtn::BundleDaemon::get_routing_state().
Config defaults are set in RouteCommand.cc.
These must be static since they're set by the config parser before any router objects are created.
Definition at line 56 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 134 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 137 of file BundleRouter.h.
Referenced by BundleRouter(), and dtn::TableBasedRouter::check_next_hop().
BundleList* dtn::BundleRouter::custody_bundles_ [protected] |
The list of all bundles that I have custody of.
Definition at line 140 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 144 of file BundleRouter.h.
Referenced by BundleRouter(), dtn::TableBasedRouter::fwd_to_nexthop(), dtn::LinkStateRouter::handle_bundle_received(), and dtn::LinkStateRouter::send_announcement().