dtn::BundleRouter Class Reference

#include <BundleRouter.h>

Inheritance diagram for dtn::BundleRouter:

dtn::BundleEventHandler oasys::Logger dtn::LinkStateRouter dtn::ProphetRouter dtn::TableBasedRouter dtn::FloodBundleRouter dtn::NeighborhoodRouter dtn::StaticBundleRouter dtn::TcaRouter

List of all members.


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.


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

Classes

struct  Config
 Config variables. More...

Constructor & Destructor Documentation

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

Destructor.

Definition at line 102 of file BundleRouter.cc.

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


Member Function Documentation

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

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

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]

for registration with the BundleDaemon

Definition at line 131 of file BundleRouter.cc.


Member Data Documentation

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.

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


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 08:43:47 2007 for DTN Reference Implementation by  doxygen 1.5.3