00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _INTERFACE_TABLE_H_
00018 #define _INTERFACE_TABLE_H_
00019
00020 #include <string>
00021 #include <list>
00022 #include <oasys/debug/DebugUtils.h>
00023 #include <oasys/util/StringBuffer.h>
00024
00025 namespace dtn {
00026
00027 class ConvergenceLayer;
00028 class Interface;
00029
00033 typedef std::list<Interface*> InterfaceList;
00034
00038 class InterfaceTable : public oasys::Logger {
00039 public:
00043 static InterfaceTable* instance() {
00044 if (instance_ == NULL) {
00045 PANIC("InterfaceTable::init not called yet");
00046 }
00047 return instance_;
00048 }
00049
00054 static void init() {
00055 if (instance_ != NULL) {
00056 PANIC("InterfaceTable::init called multiple times");
00057 }
00058 instance_ = new InterfaceTable();
00059 }
00060
00064 InterfaceTable();
00065
00069 virtual ~InterfaceTable();
00070
00076 bool add(const std::string& name, ConvergenceLayer* cl, const char* proto,
00077 int argc, const char* argv[]);
00078
00082 bool del(const std::string& name);
00083
00087 void list(oasys::StringBuffer *buf);
00088
00089 protected:
00090 static InterfaceTable* instance_;
00091
00097 InterfaceList iflist_;
00098
00103 bool find(const std::string& name, InterfaceList::iterator* iter);
00104 };
00105
00106 }
00107
00108 #endif