OverSim
ConnectReaSE.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2010 Institut fuer Telematik, Karlsruher Institut fuer Technologie (KIT)
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 CONNECTREASE_H_
25 #define CONNECTREASE_H_
26 
27 #include <omnetpp.h>
28 
29 #include <InitStages.h>
30 
31 
32 class IInterfaceTable;
33 class InterfaceEntry;
34 class IRoutingTable;
35 class IPRoute;
36 
37 
38 
39 struct edgeRoutes
40 {
41 public:
43  IInterfaceTable* interfaceTable;
44  IRoutingTable* routingTable;
45  uint32 IPAddress;
46  uint32 lastIP;
47  cModule* Router;
48  std::vector<uint32> IPAddresses;
49  std::string channelTypeRxStr;
50  std::string channelTypeTxStr;
51 };
52 
53 struct autoSystem
54 {
55 public:
56  //cModule* AS;
57  std::vector<edgeRoutes> edgeRouter;
58  uint32 edgeShift;
59 };
60 
62 {
63 public:
64  cModule* pModule;
65  const char* property;
66 };
67 
68 struct edgePool
69 {
70 public:
72  uint32 indexAS;
73 };
74 
75 
77 {
78 public:
79  uint32 IPAddress;
80  cModule* module;
81  IInterfaceTable* interfaceTable;
82  IRoutingTable* routingTable;
83  cModule* PPPInterface;
84  cModule* remotePPPInterface;
85  InterfaceEntry* interfaceEntry;
86  InterfaceEntry* remoteInterfaceEntry;
87  IInterfaceTable* remoteInterfaceTable;
88  IPRoute* routingEntry;
91  int ASindex; // deleteable?
92  simtime_t createdAt;
93 
94  friend std::ostream& operator<<(std::ostream& os, terminalInfo& n);
95 };
96 
98 {
99 public:
101  cModule* terminal;
102  uint32 IPAddress;
103  int ASindex;
104 };
105 
106 class ConnectReaSE : public cSimpleModule
107 {
108 
109 public:
115  virtual int addOverlayNode(AccessInfo* overlayNode, bool migrate = false);
121  virtual AccessInfo getAccessNode();
125  virtual cModule* removeOverlayNode(int ID);
132  virtual cModule* getOverlayNode(int ID);
133  /*
134  * migrates given node to a different edge router
135  */
136  virtual AccessInfo migrateNode(int ID);
137 
138 protected:
144  virtual int numInitStages() const
145  {
146  return MAX_STAGE_UNDERLAY + 1;
147  }
148 
152  virtual void initialize(int stage);
153 
159  virtual void handleMessage(cMessage* msg);
160 
164  virtual void updateDisplayString();
165 
166  std::vector<std::string> channelTypesRx;
167 
168  std::vector<std::string> channelTypesTx;
169 
170 
171  std::vector<terminalInfo> overlayTerminal;
172 
173  // statistics
174  cOutVector lifetimeVector;
175 
176  std::vector<autoSystem> AS_Pool; //<! list of autonomous systems of the topology
177  std::vector<edgePool> globalEdgePool; //<! dedicated list of all connectable routers
179  double channelDiversity; //<! percentage that a channel delay can differ
180 
181 private:
189  cGate* firstUnusedGate(cModule* owner, const char* name, cGate::Type type = cGate::NONE);
197  void setUpAS(cModule* currAS);
204  static bool extractFromParentModule(cModule* currModule, void * properties);
205 
206 };
207 
208 
209 #endif /* CONNECTREASE_H_ */