dtn::BundleRouter Class Reference

The BundleRouter is the main decision maker for all routing decisions related to bundles. More...

#include <BundleRouter.h>

Inheritance diagram for dtn::BundleRouter:
dtn::BundleEventHandler dtn::ProphetRouter dtn::TableBasedRouter dtn::DTLSRRouter dtn::FloodBundleRouter dtn::StaticBundleRouter dtn::TcaRouter

List of all members.

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 BundleRoutercreate_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.
BundleListpending_bundles_
 The list of all bundles still pending delivery.
BundleListcustody_bundles_
 The list of all bundles that I have custody of.
BundleActionsactions_
 The actions interface, set by the BundleDaemon when the router is initialized.

Detailed Description

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.


Constructor & Destructor Documentation

virtual dtn::BundleRouter::~BundleRouter (  )  [virtual]

Destructor.

dtn::BundleRouter::BundleRouter ( const char *  classname,
const std::string &  name 
) [protected]

Constructor.


Member Function Documentation

virtual bool dtn::BundleRouter::accept_bundle ( Bundle bundle,
int *  errp 
) [virtual]

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).

Returns:
true if the bundle was accepted. if false, then errp is set to a value from BundleProtocol::status_report_reason_t

Reimplemented in dtn::ProphetRouter.

Referenced by dtn::ProphetRouter::accept_bundle().

virtual bool dtn::BundleRouter::can_delete_bundle ( const BundleRef bundle  )  [virtual]

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]
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.


Member Data Documentation

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().

The list of all bundles still pending delivery.

Definition at line 197 of file BundleRouter.h.

Referenced by dtn::TableBasedRouter::reroute_all_bundles().


The documentation for this class was generated from the following file:
Generated on Sun Nov 21 11:41:09 2010 for DTN Reference Implementation by  doxygen 1.6.3