00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef _CONVERGENCE_LAYER_H_
00039 #define _CONVERGENCE_LAYER_H_
00040
00041 #include <string>
00042 #include <vector>
00043
00044 #include "contacts/Contact.h"
00045 #include "contacts/Interface.h"
00046
00047
00048 namespace oasys {
00049 class StringBuffer;
00050 }
00051
00052 namespace dtn {
00053
00057 class ConvergenceLayer : public oasys::Logger {
00058 public:
00062 ConvergenceLayer(const char* classname,
00063 const char* name)
00064 : Logger(classname, "/dtn/cl/%s", name),
00065 name_(name)
00066 {
00067 }
00068
00072 virtual ~ConvergenceLayer();
00073
00077 virtual bool set_interface_defaults(int argc, const char* argv[],
00078 const char** invalidp);
00079
00083 virtual bool set_link_defaults(int argc, const char* argv[],
00084 const char** invalidp);
00085
00089 virtual bool interface_up(Interface* iface,
00090 int argc, const char* argv[]);
00091
00095 virtual bool interface_down(Interface* iface);
00096
00100 virtual void dump_interface(Interface* iface, oasys::StringBuffer* buf);
00101
00105 virtual bool init_link(Link* link, int argc, const char* argv[]);
00106
00110 virtual void dump_link(Link* link, oasys::StringBuffer* buf);
00111
00115 virtual bool reconfigure_link(Link* link, int argc, const char* argv[]);
00116
00123 virtual bool open_contact(const ContactRef& contact) = 0;
00124
00136 virtual bool close_contact(const ContactRef& contact);
00137
00146 virtual void send_bundle(const ContactRef& contact, Bundle* bundle) = 0;
00147
00151 virtual bool cancel_bundle(const ContactRef& contact, Bundle* bundle)
00152 {
00153 (void)contact;
00154 (void)bundle;
00155 return false;
00156 }
00157
00162 virtual bool is_queued(const ContactRef& contact, Bundle* bundle)
00163 {
00164 (void)contact;
00165 (void)bundle;
00166 return false;
00167 }
00168
00173 static void init_clayers();
00174 static void add_clayer(ConvergenceLayer* cl);
00175
00180 static ConvergenceLayer* find_clayer(const char* proto);
00181
00185 const char* name() { return name_; }
00186
00190 static const u_int32_t MAGIC = 0x64746e21;
00191
00192 protected:
00196 const char* name_;
00197
00202 typedef std::vector<ConvergenceLayer*> CLVec;
00203 static CLVec clayers_;
00204 };
00205
00210 class CLInfo {
00211 public:
00212 virtual ~CLInfo() {}
00213 };
00214
00215 }
00216
00217 #endif