dtn::ConvergenceLayer Class Reference

#include <ConvergenceLayer.h>

Inheritance diagram for dtn::ConvergenceLayer:

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

Detailed Description

The abstract interface for a convergence layer.

Definition at line 57 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 Types

typedef std::vector< ConvergenceLayer * > CLVec
 Use a static vector to enumerate the convergence layers that are currently implemented.

Protected Attributes

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

Static Protected Attributes

static CLVec clayers_


Member Typedef Documentation

typedef std::vector<ConvergenceLayer*> dtn::ConvergenceLayer::CLVec [protected]

Use a static vector to enumerate the convergence layers that are currently implemented.

Definition at line 202 of file ConvergenceLayer.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 62 of file ConvergenceLayer.h.

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

Destructor.

Definition at line 52 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 97 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::TCPConvergenceLayer.

Definition at line 110 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 123 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 135 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 144 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::BluetoothConvergenceLayer, dtn::ConnectionConvergenceLayer, dtn::UDPConvergenceLayer, and dtnsim::SimConvergenceLayer.

Definition at line 152 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 163 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 171 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::BluetoothConvergenceLayer, 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::BluetoothConvergenceLayer, dtn::ConnectionConvergenceLayer, dtn::FileConvergenceLayer, and dtn::UDPConvergenceLayer.

Definition at line 180 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::BluetoothConvergenceLayer, 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 151 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 162 of file ConvergenceLayer.h.

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

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

Definition at line 65 of file ConvergenceLayer.cc.

References add_clayer().

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

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

Definition at line 58 of file ConvergenceLayer.cc.

References clayers_.

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 82 of file ConvergenceLayer.cc.

References clayers_.

Referenced by 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 185 of file ConvergenceLayer.h.

References name_.

Referenced by dtn::ForwardingLog::add_entry(), 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 190 of file ConvergenceLayer.h.

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

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

The unique name of this convergence layer.

Definition at line 196 of file ConvergenceLayer.h.

Referenced by name().

ConvergenceLayer::CLVec dtn::ConvergenceLayer::clayers_ [static, protected]

Definition at line 203 of file ConvergenceLayer.h.

Referenced by add_clayer(), and find_clayer().


The documentation for this class was generated from the following files:
Generated on Fri Dec 22 14:48:04 2006 for DTN Reference Implementation by  doxygen 1.5.1