InterfaceTable.h

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2004-2006 Intel Corporation
00003  * 
00004  *    Licensed under the Apache License, Version 2.0 (the "License");
00005  *    you may not use this file except in compliance with the License.
00006  *    You may obtain a copy of the License at
00007  * 
00008  *        http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  *    Unless required by applicable law or agreed to in writing, software
00011  *    distributed under the License is distributed on an "AS IS" BASIS,
00012  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *    See the License for the specific language governing permissions and
00014  *    limitations under the License.
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 } // namespace dtn
00107 
00108 #endif /* _INTERFACE_TABLE_H_ */

Generated on Thu Jun 7 16:56:50 2007 for DTN Reference Implementation by  doxygen 1.5.1