dtn::TcaRouter Class Reference

#include <TcaRouter.h>

Inheritance diagram for dtn::TcaRouter:

dtn::TableBasedRouter dtn::BundleRouter dtn::BundleEventHandler oasys::Logger

List of all members.


Detailed Description

This is the implementation of the TCA bundle routing algorithm.

A TCARouter is a specialized TableBasedRouter where the route table is manipulated in response to certain control bundles (for example, a "register" bundle, or a "change-of-address" bundle). Specialized routing logic is then applied in order to route late-bound bundles addressed to a mobile node, to the mobile's current location in the network.

The main interface point is the overridden handle_bundle_received function which tests for the special TCA bundles (control bundles and late-bound data bundles).

Definition at line 49 of file TcaRouter.h.


Public Types

enum  Role { TCA_MOBILE, TCA_ROUTER, TCA_GATEWAY }
enum  ForwardingRule {
  FWD_NEVER, FWD_UDR_EXCLUSIVELY, FWD_UDR_NEVER, FWD_UDR_IFNECESSARY,
  FWD_UDR_ALWAYS
}

Public Member Functions

 TcaRouter (Role role)

Protected Member Functions

std::string get_role_str () const
virtual void handle_bundle_received (BundleReceivedEvent *event)
 Handler for new bundle arrivals simply forwards the newly arrived bundle to all matching entries in the table.
virtual void handle_bundle_transmitted (BundleTransmittedEvent *event)
 Default event handler when bundles are transmitted.
virtual void handle_contact_up (ContactUpEvent *event)
 When a contact comes up, check to see if there are any matching bundles for it.
virtual void handle_contact_down (ContactDownEvent *event)
 Default event handler when a contact is down.
virtual void handle_link_available (LinkAvailableEvent *event)
 Ditto if a link becomes available.
virtual void handle_link_unavailable (LinkUnavailableEvent *event)
 Default event handler when a link is unavailable.
virtual void handle_shutdown_request (ShutdownRequest *event)
 Default event handler for shutdown requests.
virtual int fwd_to_all (Bundle *bundle)
virtual int fwd_to_matching (Bundle *bundle, Link *next_hop=NULL)
 Check the route table entries that match the given bundle and have not already been found in the bundle history.
virtual int fwd_to_matching_r (Bundle *bundle, Link *next_hop, ForwardingRule fwd_rule)
bool on_coa_transmitted (Bundle *b, const TcaControlBundle &cb)
bool on_ask_transmitted (Bundle *b, const TcaControlBundle &cb)
bool on_adv_transmitted (Bundle *b, const TcaControlBundle &cb)
bool handle_register (Bundle *b)
bool handle_coa (Bundle *b)
bool handle_anonymous_bundle (Bundle *b)
bool handle_ask (Bundle *b, const TcaControlBundle &cb)
bool handle_bl_control_bundle (Bundle *b)
bool handle_bl_ask (Bundle *b, const TcaControlBundle &cb)
bool handle_get_routes (Bundle *b, const TcaControlBundle &cb)
bool handle_add_route (Bundle *b, const TcaControlBundle &cb)
bool handle_del_route (Bundle *b, const TcaControlBundle &cb)
bool handle_tca_unbound_bundle (Bundle *bundle)
bool on_route_unbound_bundle (Bundle *bundle)
bool on_gate_unbound_bundle (Bundle *bundle)
bool is_local_source (Bundle *b)
ForwardingRule get_forwarding_rule (Bundle *b)
Linkcreate_link (const std::string &link_addr)
RouteEntrycreate_route (const std::string &pattern, Link *p_link)
bool create_route (const std::string &pattern, const std::string &link_addr)
bool post_bundle (const EndpointID &src, const EndpointID &dest, const std::string &payload)
bool push_wrapped_bundle (const std::string &code, const EndpointID &src, const EndpointID &dest, const std::string &bsp)

Protected Attributes

Role role_
TcaEndpointID admin_app_

Member Enumeration Documentation

enum dtn::TcaRouter::Role

Enumerator:
TCA_MOBILE 
TCA_ROUTER 
TCA_GATEWAY 

Definition at line 53 of file TcaRouter.h.

enum dtn::TcaRouter::ForwardingRule

Enumerator:
FWD_NEVER 
FWD_UDR_EXCLUSIVELY 
FWD_UDR_NEVER 
FWD_UDR_IFNECESSARY 
FWD_UDR_ALWAYS 

Definition at line 58 of file TcaRouter.h.


Constructor & Destructor Documentation

dtn::TcaRouter::TcaRouter ( Role  role  ) 

Definition at line 110 of file TcaRouter.cc.

References admin_app_, dtn::EndpointID::c_str(), get_role_str(), log_info, oasys::Logger::logpathf(), role_, and dtn::TcaEndpointID::set_app().


Member Function Documentation

std::string dtn::TcaRouter::get_role_str (  )  const [protected]

Definition at line 127 of file TcaRouter.cc.

References role_, TCA_GATEWAY, TCA_MOBILE, and TCA_ROUTER.

Referenced by TcaRouter().

void dtn::TcaRouter::handle_bundle_received ( BundleReceivedEvent event  )  [protected, virtual]

Handler for new bundle arrivals simply forwards the newly arrived bundle to all matching entries in the table.

Reimplemented from dtn::TableBasedRouter.

Definition at line 141 of file TcaRouter.cc.

References admin_app_, dtn::TcaEndpointID::app(), dtn::Bundle::dest_, fwd_to_matching(), handle_anonymous_bundle(), handle_bl_control_bundle(), handle_coa(), handle_register(), handle_tca_unbound_bundle(), dtn::TcaEndpointID::host(), dtn::log_bundle(), dtn::EndpointID::scheme_str(), and dtn::EndpointID::ssp().

void dtn::TcaRouter::handle_bundle_transmitted ( BundleTransmittedEvent event  )  [protected, virtual]

Default event handler when bundles are transmitted.

Reimplemented from dtn::BundleEventHandler.

Definition at line 198 of file TcaRouter.cc.

References dtn::TcaEndpointID::app(), dtn::TcaControlBundle::code_, dtn::Bundle::dest_, dtn::get_payload_str(), log_debug, on_adv_transmitted(), on_ask_transmitted(), on_coa_transmitted(), and dtn::EndpointID::scheme_str().

void dtn::TcaRouter::handle_contact_up ( ContactUpEvent event  )  [protected, virtual]

When a contact comes up, check to see if there are any matching bundles for it.

Reimplemented from dtn::TableBasedRouter.

Definition at line 241 of file TcaRouter.cc.

References admin_app_, dtn::BL, dtn::TableBasedRouter::handle_contact_up(), log_debug, and post_bundle().

void dtn::TcaRouter::handle_contact_down ( ContactDownEvent event  )  [protected, virtual]

Default event handler when a contact is down.

Reimplemented from dtn::BundleEventHandler.

Definition at line 252 of file TcaRouter.cc.

References admin_app_, dtn::BL, log_debug, and post_bundle().

void dtn::TcaRouter::handle_link_available ( LinkAvailableEvent event  )  [protected, virtual]

Ditto if a link becomes available.

Reimplemented from dtn::TableBasedRouter.

Definition at line 262 of file TcaRouter.cc.

References admin_app_, dtn::BL, dtn::TableBasedRouter::handle_link_available(), log_debug, and post_bundle().

void dtn::TcaRouter::handle_link_unavailable ( LinkUnavailableEvent event  )  [protected, virtual]

Default event handler when a link is unavailable.

Reimplemented from dtn::BundleEventHandler.

Definition at line 273 of file TcaRouter.cc.

References admin_app_, dtn::BL, log_debug, and post_bundle().

void dtn::TcaRouter::handle_shutdown_request ( ShutdownRequest event  )  [protected, virtual]

Default event handler for shutdown requests.

Reimplemented from dtn::BundleEventHandler.

Definition at line 282 of file TcaRouter.cc.

References admin_app_, dtn::BL, log_debug, and post_bundle().

int dtn::TcaRouter::fwd_to_all ( Bundle bundle  )  [protected, virtual]

Definition at line 294 of file TcaRouter.cc.

References dtn::EndpointID::c_str(), count, dtn::Bundle::dest_, dtn::TableBasedRouter::fwd_to_nexthop(), dtn::RouteTable::get_matching(), log_debug, pattern(), and dtn::TableBasedRouter::route_table_.

int dtn::TcaRouter::fwd_to_matching ( Bundle bundle,
Link this_link_only = NULL 
) [protected, virtual]

Check the route table entries that match the given bundle and have not already been found in the bundle history.

If a match is found, call fwd_to_nexthop on it.

Parameters:
bundle the bundle to forward
this_link_only if specified, restricts forwarding to the given next hop link
Returns the number of matches found and assigned.

Reimplemented from dtn::TableBasedRouter.

Definition at line 325 of file TcaRouter.cc.

References fwd_to_matching_r(), and get_forwarding_rule().

Referenced by handle_bundle_received().

int dtn::TcaRouter::fwd_to_matching_r ( Bundle bundle,
Link next_hop,
ForwardingRule  fwd_rule 
) [protected, virtual]

Definition at line 337 of file TcaRouter.cc.

References dtn::EndpointID::c_str(), count, dtn::Bundle::dest_, FWD_NEVER, dtn::TableBasedRouter::fwd_to_nexthop(), FWD_UDR_ALWAYS, FWD_UDR_EXCLUSIVELY, FWD_UDR_IFNECESSARY, dtn::RouteTable::get_matching(), log_debug, dtn::Link::name(), dtn::Bundle::owner_, and dtn::TableBasedRouter::route_table_.

Referenced by fwd_to_matching(), handle_ask(), handle_coa(), handle_register(), and handle_tca_unbound_bundle().

bool dtn::TcaRouter::on_coa_transmitted ( Bundle b,
const TcaControlBundle cb 
) [protected]

Definition at line 413 of file TcaRouter.cc.

References admin_app_, dtn::TcaControlBundle::args_, dtn::BL, dtn::EndpointID::c_str(), dtn::Bundle::dest_, log_debug, post_bundle(), dtn::Bundle::source_, and dtn::EndpointID::str().

Referenced by handle_bundle_transmitted().

bool dtn::TcaRouter::on_ask_transmitted ( Bundle b,
const TcaControlBundle cb 
) [protected]

Definition at line 439 of file TcaRouter.cc.

References admin_app_, dtn::TcaControlBundle::args_, dtn::BL, dtn::check_nargs(), dtn::Bundle::dest_, log_debug, post_bundle(), dtn::Bundle::source_, and dtn::EndpointID::str().

Referenced by handle_bundle_transmitted().

bool dtn::TcaRouter::on_adv_transmitted ( Bundle b,
const TcaControlBundle cb 
) [protected]

Definition at line 461 of file TcaRouter.cc.

References admin_app_, dtn::TcaControlBundle::args_, dtn::BL, dtn::check_nargs(), dtn::Bundle::dest_, log_debug, post_bundle(), dtn::Bundle::source_, and dtn::EndpointID::str().

Referenced by handle_bundle_transmitted().

bool dtn::TcaRouter::handle_register ( Bundle b  )  [protected]

Definition at line 485 of file TcaRouter.cc.

References admin_app_, dtn::TcaControlBundle::args_, dtn::BL, dtn::Bundle::dest_, fwd_to_matching_r(), FWD_UDR_EXCLUSIVELY, dtn::get_payload_str(), dtn::log_controlbundle(), log_debug, post_bundle(), dtn::Bundle::source_, and dtn::EndpointID::str().

Referenced by handle_bundle_received().

bool dtn::TcaRouter::handle_coa ( Bundle b  )  [protected]

Definition at line 534 of file TcaRouter.cc.

References fwd_to_matching_r(), FWD_UDR_NEVER, and log_debug.

Referenced by handle_bundle_received().

bool dtn::TcaRouter::handle_anonymous_bundle ( Bundle b  )  [protected]

Definition at line 548 of file TcaRouter.cc.

References dtn::TcaControlBundle::code_, dtn::Bundle::dest_, dtn::get_payload_str(), handle_ask(), and log_debug.

Referenced by handle_bundle_received().

bool dtn::TcaRouter::handle_ask ( Bundle b,
const TcaControlBundle cb 
) [protected]

Definition at line 572 of file TcaRouter.cc.

References admin_app_, dtn::TcaControlBundle::args_, dtn::BL, dtn::check_nargs(), dtn::Bundle::dest_, fwd_to_matching_r(), FWD_UDR_NEVER, is_local_source(), post_bundle(), dtn::Bundle::source_, and dtn::EndpointID::str().

Referenced by handle_anonymous_bundle(), and handle_bl_control_bundle().

bool dtn::TcaRouter::handle_bl_control_bundle ( Bundle b  )  [protected]

Definition at line 604 of file TcaRouter.cc.

References dtn::TcaControlBundle::code_, dtn::get_payload_str(), handle_add_route(), handle_ask(), handle_del_route(), handle_get_routes(), and log_debug.

Referenced by handle_bundle_received().

bool dtn::TcaRouter::handle_bl_ask ( Bundle b,
const TcaControlBundle cb 
) [protected]

Definition at line 633 of file TcaRouter.cc.

References dtn::BL, post_bundle(), and dtn::Bundle::source_.

bool dtn::TcaRouter::handle_get_routes ( Bundle b,
const TcaControlBundle cb 
) [protected]

Definition at line 645 of file TcaRouter.cc.

References dtn::TcaControlBundle::args_, dtn::BL, dtn::check_nargs(), dtn::RouteTable::get_matching(), log_debug, pattern(), post_bundle(), dtn::TableBasedRouter::route_table_, and dtn::Bundle::source_.

Referenced by handle_bl_control_bundle().

bool dtn::TcaRouter::handle_add_route ( Bundle b,
const TcaControlBundle cb 
) [protected]

Definition at line 672 of file TcaRouter.cc.

References dtn::TcaControlBundle::args_, dtn::check_nargs(), create_route(), log_debug, and pattern().

Referenced by handle_bl_control_bundle().

bool dtn::TcaRouter::handle_del_route ( Bundle b,
const TcaControlBundle cb 
) [protected]

Definition at line 693 of file TcaRouter.cc.

References dtn::TcaControlBundle::args_, dtn::check_nargs(), dtn::RouteTable::del_entries(), log_debug, and dtn::TableBasedRouter::route_table_.

Referenced by handle_bl_control_bundle().

bool dtn::TcaRouter::handle_tca_unbound_bundle ( Bundle bundle  )  [protected]

Definition at line 719 of file TcaRouter.cc.

References admin_app_, dtn::BL, dtn::EndpointID::c_str(), dtn::Bundle::dest_, fwd_to_matching_r(), FWD_UDR_IFNECESSARY, log_debug, log_err, post_bundle(), role_, dtn::EndpointID::str(), TCA_GATEWAY, and TCA_ROUTER.

Referenced by handle_bundle_received().

bool dtn::TcaRouter::on_route_unbound_bundle ( Bundle bundle  )  [protected]

bool dtn::TcaRouter::on_gate_unbound_bundle ( Bundle bundle  )  [protected]

bool dtn::TcaRouter::is_local_source ( Bundle b  )  [protected]

Definition at line 752 of file TcaRouter.cc.

References admin_app_, dtn::TcaEndpointID::get_hostid(), dtn::Bundle::source_, and src.

Referenced by get_forwarding_rule(), and handle_ask().

TcaRouter::ForwardingRule dtn::TcaRouter::get_forwarding_rule ( Bundle b  )  [protected]

Definition at line 760 of file TcaRouter.cc.

References admin_app_, dtn::TcaEndpointID::app(), dtn::Bundle::dest_, FWD_NEVER, FWD_UDR_ALWAYS, FWD_UDR_EXCLUSIVELY, FWD_UDR_IFNECESSARY, FWD_UDR_NEVER, dtn::TcaEndpointID::host(), is_local_source(), dtn::EndpointID::scheme_str(), dtn::Bundle::source_, dtn::EndpointID::ssp(), and dtn::EndpointID::str().

Referenced by fwd_to_matching().

Link * dtn::TcaRouter::create_link ( const std::string &  link_addr  )  [protected]

Definition at line 824 of file TcaRouter.cc.

References dtn::Link::create_link(), dtn::ConvergenceLayer::find_clayer(), dtn::ContactManager::find_link(), log_err, dtn::Link::ONDEMAND, dtn::EndpointID::scheme_str(), and dtn::EndpointID::ssp().

Referenced by create_route().

RouteEntry * dtn::TcaRouter::create_route ( const std::string &  pattern,
Link p_link 
) [protected]

Definition at line 861 of file TcaRouter.cc.

References dtn::RouteTable::add_entry(), dtn::ForwardingInfo::COPY_ACTION, log_debug, and dtn::TableBasedRouter::route_table_.

Referenced by create_route(), and handle_add_route().

bool dtn::TcaRouter::create_route ( const std::string &  pattern,
const std::string &  link_addr 
) [protected]

Definition at line 877 of file TcaRouter.cc.

References create_link(), create_route(), and log_err.

bool dtn::TcaRouter::post_bundle ( const EndpointID src,
const EndpointID dest,
const std::string &  payload 
) [protected]

Definition at line 900 of file TcaRouter.cc.

References dtn::EndpointID::c_str(), dtn::EVENTSRC_ADMIN, dtn::EndpointID::length(), and log_debug.

Referenced by handle_ask(), handle_bl_ask(), handle_contact_down(), handle_contact_up(), handle_get_routes(), handle_link_available(), handle_link_unavailable(), handle_register(), handle_shutdown_request(), handle_tca_unbound_bundle(), on_adv_transmitted(), on_ask_transmitted(), on_coa_transmitted(), and push_wrapped_bundle().

bool dtn::TcaRouter::push_wrapped_bundle ( const std::string &  code,
const EndpointID src,
const EndpointID dest,
const std::string &  bsp 
) [protected]

Definition at line 938 of file TcaRouter.cc.

References admin_app_, dtn::BL, post_bundle(), and dtn::EndpointID::str().


Member Data Documentation

Role dtn::TcaRouter::role_ [protected]

Definition at line 71 of file TcaRouter.h.

Referenced by get_role_str(), handle_tca_unbound_bundle(), and TcaRouter().

TcaEndpointID dtn::TcaRouter::admin_app_ [protected]

Definition at line 73 of file TcaRouter.h.

Referenced by get_forwarding_rule(), handle_ask(), handle_bundle_received(), handle_contact_down(), handle_contact_up(), handle_link_available(), handle_link_unavailable(), handle_register(), handle_shutdown_request(), handle_tca_unbound_bundle(), is_local_source(), on_adv_transmitted(), on_ask_transmitted(), on_coa_transmitted(), push_wrapped_bundle(), and TcaRouter().


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