QuonP.h

Go to the documentation of this file.
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 __QUONP_H_
00025 #define __QUONP_H_
00026 
00027 #include <BaseOverlay.h>
00028 #include <GlobalNodeList.h>
00029 #include <GlobalStatistics.h>
00030 #include <float.h>
00031 
00032 #include <QuonP_m.h>
00033 #include <QuonPDefs.h>
00034 
00036 
00040 class QuonP : public BaseOverlay
00041 {
00042     public:
00043         // OMNeT++
00044         ~QuonP();
00045         void initializeOverlay(int stage);
00046         void finishOverlay();
00047         void handleUDPMessage(BaseOverlayMessage* msg);
00048         void handleTimerEvent(cMessage* msg);
00049         void handleAppMessage(cMessage* msg);
00050         void handleNodeGracefulLeaveNotification();
00051 
00052         QState getState();
00053         double getAOI();
00054         Vector2D getPosition();
00055         double getAreaDimension();
00056         OverlayKey getKey();
00057         long getSoftNeighborCount();
00058 
00059         PSiteMap Sites;
00060 
00061     private:
00062         // parameters
00063         simtime_t joinTimeout;
00064         simtime_t deleteTimeout;
00065         simtime_t aliveTimeout;
00066         simtime_t AOIAdaptionIntervall;
00067         double AOIWidth;
00068         double minAOI;
00069         double maxAOI;
00070         unsigned int connectionLimit;
00071         double areaDimension;
00072         simtime_t backupIntervall;
00073         bool useDynamicAOI;
00074 
00075         // timers
00076         cMessage* join_timer;
00077         cMessage* sec_timer;
00078         cMessage* alive_timer;
00079         cMessage* backup_timer;
00080         cMessage* adaption_timer;
00081 
00082         void sendToApp(cMessage* msg);
00083         void sendMessage(QuonPMessage* quonMsg, NodeHandle destination);
00084         void setBootstrapedIcon();
00085         void changeState(QState qstate);
00086 
00087         // timer processing
00088         void processJoinTimer();
00089         void processSecTimer();
00090         void processDeleteTimer(cMessage* msg);
00091         void processAliveTimer();
00092         void processBackupTimer();
00093 
00094         // app handlers
00095         void handleJoin(GameAPIPositionMessage* gameMsg);
00096         void handleMove(GameAPIPositionMessage* gameMsg);
00097         void handleEvent(GameAPIMessage* msg);
00098 
00099         // overlay handlers
00100         void handleJoinRequest(QuonPMessage* quonMsg);
00101         void handleJoinAcknowledge(QuonPListMessage* quonListMsg);
00102         void handleNodeMove(QuonPMoveMessage* quonMoveMsg);
00103         void handleNewNeighbors(QuonPListMessage* quonListMsg);
00104         void handleNodeLeave(QuonPListMessage* quonListMsg);
00105         void handleInvalidNode(QuonPListMessage* quonListMsg);
00106         void handleInvalidNode(QuonPMoveMessage* quonMoveMsg);
00107 
00108         // app<->overlay synchronisation
00109         void synchronizeAppNeighbors(QPurgeType purgeSoftSites = QKEEPSOFT);
00110         void deleteAppNeighbor(NodeHandle node);
00111 
00112         // statistics
00113         double joinRequestBytesSend;
00114         double joinAcknowledgeBytesSend;
00115         double nodeMoveBytesSend;
00116         double newNeighborsBytesSend;
00117         double nodeLeaveBytesSend;
00118         double maxBytesPerSecondSend;
00119         double averageBytesPerSecondSend;
00120         double bytesPerSecond;
00121         long softConnections;
00122         long softNeighborCount;
00123         long bindingNeighborCount;
00124         long directNeighborCount;
00125         //long rejoinCount;
00126 
00127         // p-quadtree root
00128         PTreeNode* PTree;
00129 
00130         // p-quadtree functions
00131         bool addSite(Vector2D p, NodeHandle node, double AOI, QNeighborType type = QUNDEFINED, QUpdateType update = QFOREIGN);
00132         void updateThisSite(Vector2D p);
00133         void classifySites();
00134         bool deleteSite(NodeHandle node);
00135         int purgeSites(QPurgeType purgeSoftSites = QKEEPSOFT);
00136 
00137         // node references
00138         QPSite* thisSite;
00139         QDeleteMap deletedSites;
00140         NodeHandle bindingBackup[4];
00141 
00142         // node state
00143         QState qstate;
00144 };
00145 
00146 #endif

Generated on Wed Mar 25 16:32:49 2009 for OverSim by  doxygen 1.5.5