The BundleRouter is the main decision maker for all routing decisions related to bundles. More...
#include <BundleRouter.h>
Classes | |
struct | Config |
Config variables. More... | |
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 bool | can_delete_bundle (const BundleRef &bundle) |
Synchronous probe indicating whether or not this bundle can be deleted by the system. | |
virtual void | delete_bundle (const BundleRef &bundle) |
Synchronous call indicating that the bundle is being deleted from the system and that the router should remove it from any lists where it may be queued. | |
virtual void | get_routing_state (oasys::StringBuffer *buf)=0 |
Format the given StringBuffer with current routing info. | |
virtual bool | should_fwd (const Bundle *bundle, const LinkRef &link, ForwardingInfo::action_t action=ForwardingInfo::COPY_ACTION) |
Check if the bundle should be forwarded to the given next hop. | |
virtual void | tcl_dump_state (oasys::StringBuffer *buf) |
Format the given StringBuffer with a tcl-parsable version of the routing state. | |
virtual void | recompute_routes () |
Hook to force route recomputation from the command interpreter. | |
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. |
The BundleRouter is the main decision maker for all routing decisions related to bundles.
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.
virtual dtn::BundleRouter::~BundleRouter | ( | ) | [virtual] |
Destructor.
dtn::BundleRouter::BundleRouter | ( | const char * | classname, | |
const std::string & | name | |||
) | [protected] |
Constructor.
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).
Reimplemented in dtn::ProphetRouter.
Referenced by dtn::ProphetRouter::accept_bundle().
Synchronous probe indicating whether or not this bundle can be deleted by the system.
The default implementation returns true if the bundle is queued on more than one list (i.e. the pending bundles list).
Reimplemented in dtn::DTLSRRouter, and dtn::TableBasedRouter.
static BundleRouter* dtn::BundleRouter::create_router | ( | const char * | type | ) | [static] |
Factory method to create the correct subclass of BundleRouter for the registered algorithm type.
virtual void dtn::BundleRouter::delete_bundle | ( | const BundleRef & | bundle | ) | [virtual] |
Synchronous call indicating that the bundle is being deleted from the system and that the router should remove it from any lists where it may be queued.
Reimplemented in dtn::DTLSRRouter, and dtn::TableBasedRouter.
virtual void dtn::BundleRouter::get_routing_state | ( | oasys::StringBuffer * | buf | ) | [pure virtual] |
Format the given StringBuffer with current routing info.
Implemented in dtn::DTLSRRouter, dtn::ProphetRouter, and dtn::TableBasedRouter.
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::ProphetRouter, and dtn::TableBasedRouter.
Referenced by dtn::BundleDaemon::load_registrations().
virtual void dtn::BundleRouter::initialize | ( | ) | [virtual] |
Reimplemented in dtn::DTLSRRouter, dtn::FloodBundleRouter, and dtn::ProphetRouter.
Referenced by dtnsim::Node::configure().
virtual void dtn::BundleRouter::recompute_routes | ( | ) | [virtual] |
Hook to force route recomputation from the command interpreter.
The default implementation does nothing.
Reimplemented in dtn::DTLSRRouter, and dtn::TableBasedRouter.
virtual bool dtn::BundleRouter::should_fwd | ( | const Bundle * | bundle, | |
const LinkRef & | link, | |||
ForwardingInfo::action_t | action = ForwardingInfo::COPY_ACTION | |||
) | [virtual] |
Check if the bundle should be forwarded to the given next hop.
Reasons why it would not be forwarded include that it was already transmitted or is currently in flight on the link, or that the route indicates ForwardingInfo::FORWARD_ACTION and it is already in flight on another route.
Referenced by dtn::TableBasedRouter::check_next_hop(), and dtn::ProphetBundleCore::should_fwd().
virtual void dtn::BundleRouter::shutdown | ( | ) | [virtual] |
for registration with the BundleDaemon
Reimplemented in dtn::ProphetRouter.
virtual void dtn::BundleRouter::tcl_dump_state | ( | oasys::StringBuffer * | buf | ) | [virtual] |
Format the given StringBuffer with a tcl-parsable version of the routing state.
The expected format is:
{ {dest_eid1 nexthop_link1 [params]} {dest_eid2 nexthop_link2 [params]} }
where [params] is a var val list.
Reimplemented in dtn::TableBasedRouter.
BundleActions* dtn::BundleRouter::actions_ [protected] |
The actions interface, set by the BundleDaemon when the router is initialized.
Definition at line 204 of file BundleRouter.h.
Referenced by dtn::TableBasedRouter::check_next_hop(), dtn::TableBasedRouter::fwd_to_nexthop(), dtn::TableBasedRouter::handle_link_available(), dtn::ProphetRouter::handle_link_available(), dtn::ProphetRouter::initialize(), and dtn::TableBasedRouter::reroute_bundles().
struct dtn::BundleRouter::Config dtn::BundleRouter::config_ [static] |
Config variables.
These must be static since they're set by the config parser before any router objects are created.
Referenced by dtn::TableBasedRouter::add_nexthop_route(), dtn::DTLSRRouter::DTLSRRouter(), dtn::RouteTable::get_matching_helper(), dtn::FloodBundleRouter::handle_bundle_received(), dtn::TableBasedRouter::handle_link_available(), dtn::RouteCommand::RouteCommand(), and dtn::TableBasedRouter::subscribe_to_session().
BundleList* dtn::BundleRouter::custody_bundles_ [protected] |
The list of all bundles that I have custody of.
Definition at line 200 of file BundleRouter.h.
std::string dtn::BundleRouter::name_ [protected] |
Name of this particular router.
Definition at line 194 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 197 of file BundleRouter.h.
Referenced by dtn::TableBasedRouter::reroute_all_bundles().