Vast.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00024 #ifndef __VAST_H_
00025 #define __VAST_H_
00026
00027 #include <omnetpp.h>
00028 #include <BaseOverlay.h>
00029 #include <float.h>
00030 #include <VastDefs.h>
00031 #include <Vast_m.h>
00032
00033
00034
00035
00037
00041 class Vast : public BaseOverlay
00042 {
00043 public:
00044
00045 ~Vast();
00046 void initializeOverlay(int stage);
00047 void finishOverlay();
00048 void handleUDPMessage(BaseOverlayMessage* msg);
00049 void handleTimerEvent(cMessage* msg);
00050 void handleAppMessage(cMessage* msg);
00051 void handleNodeLeaveNotification();
00052 void handleNodeGracefulLeaveNotification();
00053
00054 double getAOI();
00055 Vector2D getPosition();
00056 NodeHandle getHandle();
00057 double getAreaDimension();
00058
00059 SiteMap Sites;
00060 Site thisSite;
00061
00062 protected:
00063
00064 double AOI_size;
00065 double areaDimension;
00066 PositionSet Positions;
00067 StockList Stock;
00068
00069
00070 long joinRequestBytesSent;
00071 long joinAcknowledgeBytesSent;
00072 long nodeMoveBytesSent;
00073 long newNeighborsBytesSent;
00074 long nodeLeaveBytesSent;
00075 long enclosingNeighborsRequestBytesSent;
00076 long pingBytesSent;
00077 long pongBytesSent;
00078 long discardNodeBytesSent;
00079
00080 long maxBytesPerSecondSent, averageBytesPerSecondSent, bytesPerSecond;
00081 unsigned int secTimerCount;
00082
00083
00084 bool debugVoronoiOutput;
00085 simtime_t joinTimeout, pingTimeout, discoveryIntervall, checkCriticalIntervall;
00086 double criticalThreshold;
00087 unsigned long stockListSize;
00088
00089
00090 Geometry geom;
00091 EdgeList edgelist;
00092 HeapPQ heap;
00093
00094 void addNode(Vector2D p, NodeHandle node, int NeighborCount = 0);
00095 void addNodeToStock(NodeHandle node);
00096 void removeNode(NodeHandle node);
00097 void buildVoronoi();
00098 void buildVoronoi(Vector2D old_pos, Vector2D new_pos, NodeHandle enclosingCheck = NodeHandle::UNSPECIFIED_NODE);
00099 void removeNeighbors();
00100
00101
00102 cMessage* join_timer;
00103 cMessage* ping_timer;
00104 cMessage* discovery_timer;
00105 cMessage* checkcritical_timer;
00106 cMessage* sec_timer;
00107
00108 void sendToApp(cMessage* msg);
00109 void sendMessage(VastMessage* vastMsg, NodeHandle destAddr);
00110 void setBootstrapedIcon();
00111 void changeState(int state);
00112
00113
00114 void processJoinTimer();
00115 void processPingTimer();
00116 void processSecTimer();
00117 void processCheckCriticalTimer();
00118 void processDiscoveryTimer();
00119
00120
00121 void handleJoin(GameAPIPositionMessage* sgcMsg);
00122 void handleMove(GameAPIPositionMessage* sgcMsg);
00123 void handleEvent(GameAPIMessage* msg);
00124
00125
00126 void handleJoinRequest(VastMessage *vastMsg);
00127 void handleJoinAcknowledge(VastListMessage *vastListMsg);
00128 void handleNodeMove(VastMoveMessage *vastMoveMsg);
00129 void handleNewNeighbors(VastListMessage *vastListMsg);
00130 void handleNodeLeave(VastListMessage *vastListMsg);
00131 void handleEnclosingNeighborsRequest(VastMessage *vastMsg);
00132 void handleBackupNeighbors(VastListMessage *vastListMsg);
00133 void handlePing(VastMessage *vastMsg);
00134 void handlePong(VastMessage *vastMsg);
00135 void handleDiscardNode(VastDiscardMessage *vastMsg);
00136 void sendDiscardNode(VastMessage *vastMsg);
00137 void synchronizeApp(VastMoveMessage *vastMoveMsg = NULL);
00138 };
00139
00140 #endif