dtn::ConvergenceLayer Class Reference

#include <ConvergenceLayer.h>

Inheritance diagram for dtn::ConvergenceLayer:

oasys::Logger dtn::ConnectionConvergenceLayer dtn::FileConvergenceLayer dtn::IPConvergenceLayer dtn::NullConvergenceLayer dtnsim::SimConvergenceLayer dtn::StreamConvergenceLayer dtn::UDPConvergenceLayer dtn::BluetoothConvergenceLayer dtn::TCPConvergenceLayer List of all members.

Detailed Description

The abstract interface for a convergence layer.

Definition at line 38 of file ConvergenceLayer.h.

Public Member Functions

 ConvergenceLayer (const char *classname, const char *name)
 Constructor.
virtual ~ConvergenceLayer ()
 Destructor.
virtual bool set_interface_defaults (int argc, const char *argv[], const char **invalidp)
 Set default interface options.
virtual bool set_link_defaults (int argc, const char *argv[], const char **invalidp)
 Set default link options.
virtual bool interface_up (Interface *iface, int argc, const char *argv[])
 Bring up a new interface.
virtual bool interface_down (Interface *iface)
 Bring down the interface.
virtual void dump_interface (Interface *iface, oasys::StringBuffer *buf)
 Dump out CL specific interface information.
virtual bool init_link (Link *link, int argc, const char *argv[])
 Create any CL-specific components of the Link.
virtual void dump_link (Link *link, oasys::StringBuffer *buf)
 Dump out CL specific link information.
virtual bool reconfigure_link (Link *link, int argc, const char *argv[])
 Post-initialization, parse any CL-specific options for the link.
virtual bool open_contact (const ContactRef &contact)=0
 Open a new contact for the given link.
virtual bool close_contact (const ContactRef &contact)
 Close the open contact.
virtual void send_bundle (const ContactRef &contact, Bundle *bundle)=0
 Try to send the given bundle on the current link.
virtual bool cancel_bundle (const ContactRef &contact, Bundle *bundle)
 Try to cancel transmission of a given bundle on the contact.
virtual bool is_queued (const ContactRef &contact, Bundle *bundle)
 Hook to see if the given bundle is queued for transmission on the given contact.
const char * name ()
 Accessor for the convergence layer name.

Static Public Member Functions

static void init_clayers ()
 Boot-time initialization and registration of statically defined convergence layers.
static void add_clayer (ConvergenceLayer *cl)
static ConvergenceLayerfind_clayer (const char *proto)
 Find the appropriate convergence layer for the given string.

Static Public Attributes

static const u_int32_t MAGIC = 0x64746e21
 Magic number used for DTN convergence layers.

Protected Attributes

const char * name_
 The unique name of this convergence layer.


Constructor & Destructor Documentation

dtn::ConvergenceLayer::ConvergenceLayer ( const char *  classname,
const char *  name 
) [inline]

Constructor.

Definition at line 43 of file ConvergenceLayer.h.

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

Destructor.

Definition at line 32 of file ConvergenceLayer.cc.


Member Function Documentation

bool dtn::ConvergenceLayer::set_interface_defaults ( int  argc,
const char *  argv[],
const char **  invalidp 
) [virtual]

Set default interface options.

Definition at line 88 of file ConvergenceLayer.cc.

bool dtn::ConvergenceLayer::set_link_defaults ( int  argc,
const char *  argv[],
const char **  invalidp 
) [virtual]

Set default link options.

Reimplemented in dtn::BluetoothConvergenceLayer, and dtn::TCPConvergenceLayer.

Definition at line 101 of file ConvergenceLayer.cc.

Referenced by dtn::LinkCommand::exec().

bool dtn::ConvergenceLayer::interface_up ( Interface iface,
int  argc,
const char *  argv[] 
) [virtual]

Bring up a new interface.

Reimplemented in dtn::BluetoothConvergenceLayer, dtn::FileConvergenceLayer, dtn::TCPConvergenceLayer, and dtn::UDPConvergenceLayer.

Definition at line 114 of file ConvergenceLayer.cc.

References log_debug, and dtn::Interface::name().

Referenced by dtn::InterfaceTable::add().

bool dtn::ConvergenceLayer::interface_down ( Interface iface  )  [virtual]

Bring down the interface.

Reimplemented in dtn::BluetoothConvergenceLayer, dtn::FileConvergenceLayer, dtn::TCPConvergenceLayer, and dtn::UDPConvergenceLayer.

Definition at line 126 of file ConvergenceLayer.cc.

References log_debug, and dtn::Interface::name().

Referenced by dtn::InterfaceTable::del().

void dtn::ConvergenceLayer::dump_interface ( Interface iface,
oasys::StringBuffer buf 
) [virtual]

Dump out CL specific interface information.

Reimplemented in dtn::BluetoothConvergenceLayer, dtn::TCPConvergenceLayer, and dtn::UDPConvergenceLayer.

Definition at line 135 of file ConvergenceLayer.cc.

Referenced by dtn::InterfaceTable::list().

bool dtn::ConvergenceLayer::init_link ( Link link,
int  argc,
const char *  argv[] 
) [virtual]

Create any CL-specific components of the Link.

Reimplemented in dtn::ConnectionConvergenceLayer, dtn::UDPConvergenceLayer, and dtnsim::SimConvergenceLayer.

Definition at line 143 of file ConvergenceLayer.cc.

References log_debug, and dtn::Link::nexthop().

Referenced by dtn::Link::create_link().

void dtn::ConvergenceLayer::dump_link ( Link link,
oasys::StringBuffer buf 
) [virtual]

Dump out CL specific link information.

Reimplemented in dtn::BluetoothConvergenceLayer, dtn::ConnectionConvergenceLayer, dtn::StreamConvergenceLayer, dtn::TCPConvergenceLayer, and dtn::UDPConvergenceLayer.

Definition at line 154 of file ConvergenceLayer.cc.

Referenced by dtn::Link::dump().

bool dtn::ConvergenceLayer::reconfigure_link ( Link link,
int  argc,
const char *  argv[] 
) [virtual]

Post-initialization, parse any CL-specific options for the link.

Reimplemented in dtn::ConnectionConvergenceLayer.

Definition at line 162 of file ConvergenceLayer.cc.

Referenced by dtn::LinkCommand::exec().

virtual bool dtn::ConvergenceLayer::open_contact ( const ContactRef contact  )  [pure virtual]

Open a new contact for the given link.

The implementation will create a new Contact object (or find one that already exists), establish any CL specific connections, then post a ContactUpEvent when the contact is successfully initiated.

Implemented in dtn::ConnectionConvergenceLayer, dtn::FileConvergenceLayer, dtn::NullConvergenceLayer, dtn::UDPConvergenceLayer, and dtnsim::SimConvergenceLayer.

Referenced by dtn::Link::open().

bool dtn::ConvergenceLayer::close_contact ( const ContactRef contact  )  [virtual]

Close the open contact.

Mainly used to clean the state that is associated with this contact. This is called by the link->close() function.

Note that this function should NOT post a ContactDownEvent, as this function is only called to clean up the contact state after it has been closed (i.e. after the ContactDownEvent has been generated by some other part of the system).

Reimplemented in dtn::ConnectionConvergenceLayer, dtn::FileConvergenceLayer, and dtn::UDPConvergenceLayer.

Definition at line 171 of file ConvergenceLayer.cc.

References log_debug, and oasys::Ref< _Type >::object().

Referenced by dtn::Link::close().

virtual void dtn::ConvergenceLayer::send_bundle ( const ContactRef contact,
Bundle bundle 
) [pure virtual]

Try to send the given bundle on the current link.

In some cases (e.g. TCP) this just sticks bundles on a queue for another thread to consume (after setting the link state to BUSY). In others (e.g. UDP) there is no per-contact thread, so this callback is used to send the bundle.

Implemented in dtn::ConnectionConvergenceLayer, dtn::FileConvergenceLayer, dtn::NullConvergenceLayer, dtn::UDPConvergenceLayer, and dtnsim::SimConvergenceLayer.

Referenced by dtn::BundleActions::send_bundle().

virtual bool dtn::ConvergenceLayer::cancel_bundle ( const ContactRef contact,
Bundle bundle 
) [inline, virtual]

Try to cancel transmission of a given bundle on the contact.

Definition at line 132 of file ConvergenceLayer.h.

Referenced by dtn::BundleActions::cancel_bundle().

virtual bool dtn::ConvergenceLayer::is_queued ( const ContactRef contact,
Bundle bundle 
) [inline, virtual]

Hook to see if the given bundle is queued for transmission on the given contact.

Definition at line 143 of file ConvergenceLayer.h.

void dtn::ConvergenceLayer::init_clayers (  )  [static]

Boot-time initialization and registration of statically defined convergence layers.

Definition at line 45 of file ConvergenceLayer.cc.

References add_clayer().

Referenced by dtn::DTNServer::init_components().

void dtn::ConvergenceLayer::add_clayer ( ConvergenceLayer cl  )  [static]

Definition at line 38 of file ConvergenceLayer.cc.

Referenced by init_clayers().

ConvergenceLayer * dtn::ConvergenceLayer::find_clayer ( const char *  proto  )  [static]

Find the appropriate convergence layer for the given string.

Definition at line 71 of file ConvergenceLayer.cc.

Referenced by dtn::Discovery::announce(), dtn::TcaRouter::create_link(), dtn::LinkCommand::exec(), dtn::InterfaceCommand::exec(), and dtn::Link::serialize().

const char* dtn::ConvergenceLayer::name (  )  [inline]

Accessor for the convergence layer name.

Definition at line 166 of file ConvergenceLayer.h.

References name_.

Referenced by dtn::ForwardingLog::add_entry(), dtn::IPAnnounce::configure(), dtn::BluetoothAnnounce::configure(), dtn::Announce::create_announce(), dtn::Link::dump(), dtn::ContactManager::find_link_to(), dtn::ForwardingLog::get_latest_entry(), dtn::ContactManager::new_opportunistic_link(), dtn::Link::serialize(), and dtn::ForwardingLog::update().


Member Data Documentation

const u_int32_t dtn::ConvergenceLayer::MAGIC = 0x64746e21 [static]

Magic number used for DTN convergence layers.

Definition at line 171 of file ConvergenceLayer.h.

Referenced by dtn::StreamConvergenceLayer::Connection::handle_contact_initiation(), and dtn::StreamConvergenceLayer::Connection::initiate_contact().

const char* dtn::ConvergenceLayer::name_ [protected]

The unique name of this convergence layer.

Definition at line 177 of file ConvergenceLayer.h.

Referenced by name().


The documentation for this class was generated from the following files:
Generated on Thu Jun 7 16:56:57 2007 for DTN Reference Implementation by  doxygen 1.5.1