OverSim
SimpleUnderlayConfigurator.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
24 #ifndef __SIMPLEUNDERLAYCONFIGURATOR_H__
25 #define __SIMPLEUNDERLAYCONFIGURATOR_H__
26 
27 #include <omnetpp.h>
28 #include <BasicModule.h>
29 #include <deque>
30 #include <set>
31 
32 #include <UnderlayConfigurator.h>
33 #include <InitStages.h>
34 #include <SimpleInfo.h>
35 #include <BaseLocation.h>
36 
43 {
44 public:
46 
53  virtual TransportAddress* createNode(NodeType type, bool initialize=false);
54 
61  virtual void preKillNode(NodeType type, TransportAddress* addr=NULL);
62 
69  virtual void migrateNode(NodeType type, TransportAddress* addr=NULL);
70 
71  uint32_t getFieldSize() { return fieldSize; };
72  uint32_t getFieldDimension() { return dimensions; };
73  uint32_t getSendQueueLenghth() { return sendQueueLength; };
74 
75  // new functions for working day model
76  IPvXAddress migrateNode(NodeType type, IPvXAddress addr, const BaseLocation& locID);
77  double getDistance(const BaseLocation& IDa, const BaseLocation& IDb);
78  BaseLocation* getNearLocation(const BaseLocation& ID, double radius);
79  BaseLocation* getLocation(IPvXAddress addr);
80 
81 protected:
82 
89  void initializeUnderlay(int stage);
90 
91  void handleTimerEvent(cMessage* msg);
92 
96  void finishUnderlay();
97 
101  void setDisplayString();
102  uint32_t parseCoordFile(const char * nodeCoordinateSource);
103 
105  std::deque<IPvXAddress> killList;
106  std::set<int> scheduledID;
107 
108  uint32_t sendQueueLength;
109  uint32_t fieldSize;
112  bool useIPv6;
113 
115  const char* nodeCoordinateSource;
116  uint32_t maxCoordinate;
117 
118  std::vector<std::pair<NodeRecord*, bool> > nodeRecordPool;
119 
120  // statistics
122  int numKilled;
123 };
124 
125 #endif