The abstract interface for a convergence layer. More...
#include <ConvergenceLayer.h>
Public Member Functions | |
ConvergenceLayer (const char *classname, const char *name) | |
Constructor. | |
virtual | ~ConvergenceLayer () |
Destructor. | |
virtual bool | set_cla_parameters (AttributeVector ¶ms) |
Set CL-specific options. | |
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 (const LinkRef &link, int argc, const char *argv[]) |
Create any CL-specific components of the Link. | |
virtual void | delete_link (const LinkRef &link) |
Delete any CL-specific components of the link (requests pertaining to this link must be ignored gracefully by the CL in the future). | |
virtual void | dump_link (const LinkRef &link, oasys::StringBuffer *buf) |
Dump out CL specific link information. | |
virtual bool | reconfigure_link (const LinkRef &link, int argc, const char *argv[]) |
Post-initialization, parse any CL-specific options for the link. | |
virtual void | reconfigure_link (const LinkRef &link, AttributeVector ¶ms) |
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 | bundle_queued (const LinkRef &link, const BundleRef &bundle)=0 |
Notify the convergence layer that a bundle was queued on the link. | |
virtual void | cancel_bundle (const LinkRef &link, const BundleRef &bundle) |
Try to cancel transmission of a given bundle on the link. | |
virtual void | is_eid_reachable (const std::string &query_id, Interface *iface, const std::string &endpoint) |
Report if the given endpoint is reachable via the given interface. | |
virtual void | query_link_attributes (const std::string &query_id, const LinkRef &link, const AttributeNameVector &attributes) |
Report the values of the given link attributes. | |
virtual void | query_iface_attributes (const std::string &query_id, Interface *iface, const AttributeNameVector &attributes) |
Report the values of the given interface attributes. | |
virtual void | query_cla_parameters (const std::string &query_id, const AttributeNameVector ¶meters) |
Report the values of the convergence layer parameters. | |
virtual void | shutdown () |
Perform any necessary shutdown procedures. | |
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 ConvergenceLayer * | find_clayer (const char *proto) |
Find the appropriate convergence layer for the given string. | |
static void | shutdown_clayers () |
Shutdown all registerd convergence layers. | |
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. |
The abstract interface for a convergence layer.
Definition at line 40 of file ConvergenceLayer.h.
dtn::ConvergenceLayer::ConvergenceLayer | ( | const char * | classname, | |
const char * | name | |||
) | [inline] |
Constructor.
Definition at line 45 of file ConvergenceLayer.h.
dtn::ConvergenceLayer::~ConvergenceLayer | ( | ) | [virtual] |
Destructor.
Definition at line 35 of file ConvergenceLayer.cc.
void dtn::ConvergenceLayer::add_clayer | ( | ConvergenceLayer * | cl | ) | [static] |
Definition at line 41 of file ConvergenceLayer.cc.
Referenced by init_clayers().
virtual void dtn::ConvergenceLayer::bundle_queued | ( | const LinkRef & | link, | |
const BundleRef & | bundle | |||
) | [pure virtual] |
Notify the convergence layer that a bundle was queued on the link.
In some cases (e.g. TCP) this just kicks the other thread to notice that there are bundles to send out. 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::NullConvergenceLayer, and dtn::UDPConvergenceLayer.
void dtn::ConvergenceLayer::cancel_bundle | ( | const LinkRef & | link, | |
const BundleRef & | bundle | |||
) | [virtual] |
Try to cancel transmission of a given bundle on the link.
Reimplemented in dtn::ConnectionConvergenceLayer, and dtn::NullConvergenceLayer.
Definition at line 227 of file ConvergenceLayer.cc.
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 218 of file ConvergenceLayer.cc.
void dtn::ConvergenceLayer::delete_link | ( | const LinkRef & | link | ) | [virtual] |
Delete any CL-specific components of the link (requests pertaining to this link must be ignored gracefully by the CL in the future).
Reimplemented in dtn::ConnectionConvergenceLayer, dtn::NullConvergenceLayer, and dtn::UDPConvergenceLayer.
Definition at line 181 of file ConvergenceLayer.cc.
References ASSERT.
void dtn::ConvergenceLayer::dump_interface | ( | Interface * | iface, | |
oasys::StringBuffer * | buf | |||
) | [virtual] |
Dump out CL specific interface information.
Reimplemented in dtn::TCPConvergenceLayer, and dtn::UDPConvergenceLayer.
Definition at line 162 of file ConvergenceLayer.cc.
void dtn::ConvergenceLayer::dump_link | ( | const LinkRef & | link, | |
oasys::StringBuffer * | buf | |||
) | [virtual] |
Dump out CL specific link information.
Reimplemented in dtn::ConnectionConvergenceLayer, dtn::SerialConvergenceLayer, dtn::StreamConvergenceLayer, dtn::TCPConvergenceLayer, and dtn::UDPConvergenceLayer.
Definition at line 190 of file ConvergenceLayer.cc.
ConvergenceLayer * dtn::ConvergenceLayer::find_clayer | ( | const char * | proto | ) | [static] |
Find the appropriate convergence layer for the given string.
Definition at line 75 of file ConvergenceLayer.cc.
Referenced by dtn::TcaRouter::create_link().
void dtn::ConvergenceLayer::init_clayers | ( | ) | [static] |
Boot-time initialization and registration of statically defined convergence layers.
Definition at line 48 of file ConvergenceLayer.cc.
References add_clayer().
bool dtn::ConvergenceLayer::init_link | ( | const LinkRef & | link, | |
int | argc, | |||
const char * | argv[] | |||
) | [virtual] |
Create any CL-specific components of the Link.
Reimplemented in dtn::ConnectionConvergenceLayer, dtn::NullConvergenceLayer, and dtn::UDPConvergenceLayer.
Definition at line 170 of file ConvergenceLayer.cc.
Bring down the interface.
Reimplemented in dtn::FileConvergenceLayer, dtn::TCPConvergenceLayer, and dtn::UDPConvergenceLayer.
Definition at line 153 of file ConvergenceLayer.cc.
References dtn::Interface::name().
bool dtn::ConvergenceLayer::interface_up | ( | Interface * | iface, | |
int | argc, | |||
const char * | argv[] | |||
) | [virtual] |
Bring up a new interface.
Reimplemented in dtn::FileConvergenceLayer, dtn::TCPConvergenceLayer, and dtn::UDPConvergenceLayer.
Definition at line 141 of file ConvergenceLayer.cc.
References dtn::Interface::name().
void dtn::ConvergenceLayer::is_eid_reachable | ( | const std::string & | query_id, | |
Interface * | iface, | |||
const std::string & | endpoint | |||
) | [virtual] |
Report if the given endpoint is reachable via the given interface.
Definition at line 235 of file ConvergenceLayer.cc.
References dtn::BundleDaemon::post().
const char* dtn::ConvergenceLayer::name | ( | ) | [inline] |
Accessor for the convergence layer name.
Definition at line 205 of file ConvergenceLayer.h.
References name_.
Referenced by dtn::IPAnnounce::configure(), and dtn::Announce::create_announce().
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, and dtn::UDPConvergenceLayer.
void dtn::ConvergenceLayer::query_cla_parameters | ( | const std::string & | query_id, | |
const AttributeNameVector & | parameters | |||
) | [virtual] |
Report the values of the convergence layer parameters.
Definition at line 279 of file ConvergenceLayer.cc.
References dtn::BundleDaemon::post().
void dtn::ConvergenceLayer::query_iface_attributes | ( | const std::string & | query_id, | |
Interface * | iface, | |||
const AttributeNameVector & | attributes | |||
) | [virtual] |
Report the values of the given interface attributes.
Definition at line 266 of file ConvergenceLayer.cc.
References dtn::BundleDaemon::post().
void dtn::ConvergenceLayer::query_link_attributes | ( | const std::string & | query_id, | |
const LinkRef & | link, | |||
const AttributeNameVector & | attributes | |||
) | [virtual] |
Report the values of the given link attributes.
Definition at line 247 of file ConvergenceLayer.cc.
References ASSERT, and dtn::BundleDaemon::post().
void dtn::ConvergenceLayer::reconfigure_link | ( | const LinkRef & | link, | |
AttributeVector & | params | |||
) | [virtual] |
Definition at line 208 of file ConvergenceLayer.cc.
bool dtn::ConvergenceLayer::reconfigure_link | ( | const LinkRef & | link, | |
int | argc, | |||
const char * | argv[] | |||
) | [virtual] |
Post-initialization, parse any CL-specific options for the link.
Reimplemented in dtn::ConnectionConvergenceLayer, and dtn::NullConvergenceLayer.
Definition at line 198 of file ConvergenceLayer.cc.
bool dtn::ConvergenceLayer::set_cla_parameters | ( | AttributeVector & | params | ) | [virtual] |
Set CL-specific options.
Definition at line 105 of file ConvergenceLayer.cc.
References dtn::BundleDaemon::post().
bool dtn::ConvergenceLayer::set_interface_defaults | ( | int | argc, | |
const char * | argv[], | |||
const char ** | invalidp | |||
) | [virtual] |
Set default interface options.
Definition at line 115 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::SerialConvergenceLayer, and dtn::TCPConvergenceLayer.
Definition at line 128 of file ConvergenceLayer.cc.
virtual void dtn::ConvergenceLayer::shutdown | ( | ) | [inline, virtual] |
Perform any necessary shutdown procedures.
Definition at line 182 of file ConvergenceLayer.h.
void dtn::ConvergenceLayer::shutdown_clayers | ( | ) | [static] |
Shutdown all registerd convergence layers.
Definition at line 92 of file ConvergenceLayer.cc.
const u_int32_t dtn::ConvergenceLayer::MAGIC = 0x64746e21 [static] |
Magic number used for DTN convergence layers.
Definition at line 210 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 216 of file ConvergenceLayer.h.
Referenced by name().