00001 // 00002 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH) 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 // 00018 00024 #ifndef __SIMPLEUNDERLAYCONFIGURATOR_H__ 00025 #define __SIMPLEUNDERLAYCONFIGURATOR_H__ 00026 00027 00028 #include <omnetpp.h> 00029 #include <BasicModule.h> 00030 #include <deque> 00031 #include <set> 00032 00033 #include <UnderlayConfigurator.h> 00034 #include <InitStages.h> 00035 #include <SimpleInfo.h> 00036 00037 00043 class SimpleUnderlayConfigurator : public UnderlayConfigurator 00044 { 00045 public: 00046 ~SimpleUnderlayConfigurator(); 00047 00054 virtual TransportAddress* createNode(NodeType type, bool initialize=false); 00055 00062 virtual void preKillNode(NodeType type, TransportAddress* addr=NULL); 00063 00070 virtual void migrateNode(NodeType type, TransportAddress* addr=NULL); 00071 00072 uint32_t getFieldSize() { return fieldSize; }; 00073 uint32_t getFieldDimension() { return dimensions; }; 00074 uint32_t getSendQueueLenghth() { return sendQueueLength; }; 00075 00076 protected: 00077 00084 void initializeUnderlay(int stage); 00085 00086 void handleTimerEvent(cMessage* msg); 00087 00091 void finishUnderlay(); 00092 00096 void setDisplayString(); 00097 uint32_t parseCoordFile(const char * nodeCoordinateSource); 00098 00099 uint32 nextFreeAddress; 00100 std::deque<IPvXAddress> killList; 00101 std::set<int> scheduledID; 00102 00103 uint32_t sendQueueLength; 00104 uint32_t fieldSize; 00105 int dimensions; 00106 bool fixedNodePositions; 00107 00108 bool useXmlCoords; 00109 const char* nodeCoordinateSource; 00110 uint32_t maxCoordinate; 00111 00112 std::vector<std::pair<NodeRecord*, bool> > nodeRecordPool; 00113 00114 // statistics 00115 int numCreated; 00116 int numKilled; 00117 }; 00118 00119 #endif