PubSubMMOG.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 __PUBSUBMMOG_H_
00025 #define __PUBSUBMMOG_H_
00026 
00027 #include <omnetpp.h>
00028 #include <NodeHandle.h>
00029 #include <BaseOverlay.h>
00030 #include "PubSubSubspace.h"
00031 #include "PubSubMessage_m.h"
00032 
00033 class PubSubMMOG : public BaseOverlay
00034 {
00035     public:
00036         // OMNeT++
00037         virtual ~PubSubMMOG();
00038         virtual void initializeOverlay(int stage);
00039         virtual void finishOverlay();
00040         virtual void handleUDPMessage(BaseOverlayMessage* msg);
00041         virtual void handleTimerEvent(cMessage* msg);
00042         virtual void handleAppMessage(cMessage* msg);
00043         virtual void receiveChangeNotification(int category, const cPolymorphic *details);
00044         virtual bool handleRpcCall(BaseCallMessage* msg);
00045         virtual void handleRpcResponse(BaseResponseMessage *msg,
00046                                        cPolymorphic* context,
00047                                        int rpcId, simtime_t rtt);
00048         virtual void handleRpcTimeout(BaseCallMessage *msg,
00049                                       const TransportAddress & dest,
00050                                       cPolymorphic* context,
00051                                       int rpcId, const OverlayKey &destKey);
00052 
00053     protected:
00054 
00055         void setBootstrapedIcon();
00056         void handleMove( GameAPIPositionMessage* posMsg );
00057         void handleMoveMessage( PubSubMoveMessage* moveMsg );
00058         void handleMoveListMessage( PubSubMoveListMessage* moveMsg );
00059         void handleJoinResponse( PubSubJoinResponse* joinResp );
00060         void handleSubscriptionCall( PubSubSubscriptionCall* subCall );
00061         void handleSubscriptionResponse( PubSubSubscriptionResponse* subResp );
00062         void handleResponsibleNodeResponse( PubSubResponsibleNodeResponse* subResp );
00063         void handleTakeOver( PubSubTakeOverSubspaceCall* toCall );
00064         void handleHelpResponse( PubSubHelpResponse* helpResp );
00065         void handleBackupCall( PubSubBackupCall* backupCall );
00066         void handleBackupResponse( PubSubBackupResponse* backupResp );
00067         void handleIntermediateCall( PubSubIntermediateCall* intermediateCall );
00068         void handleIntermediateResponse( PubSubIntermediateResponse* intermediateResp );
00069         void handleAdoptChildCall( PubSubAdoptChildCall* adoptCall );
00070         void handleAdoptChildResponse( PubSubAdoptChildResponse* adoptResp );
00071         void handlePingCall( PubSubPingCall* hearbeatCall );
00072         void handlePingResponse( PubSubPingResponse* pingResp );
00073 
00074         void takeOverNewSubspace( PubSubSubspaceId subspaceId );
00075         void takeOverSubspace( PubSubSubspaceResponsible& subspaceId, bool isNew );
00076         void sendHearbeatToChildren();
00077         void sendPingToChildren();
00078         void handleParentTimeout( PubSubTimer* timer );
00079         void handleBackupCallTimeout( PubSubBackupCall* backupCall, const TransportAddress& oldNode );
00080         void handlePingCallTimeout( PubSubPingCall* pingCall, const TransportAddress& oldNode );
00081         void handleSubscriptionCallTimeout( PubSubSubscriptionCall* subscriptionCall, const TransportAddress& oldNode );
00082         void handleUnsubscriptionMessage( PubSubUnsubscriptionMessage* unsMsg );
00083         void handleNodeLeftMessage( PubSubNodeLeftMessage* leftMsg );
00084         void handleReplacementMessage( PubSubReplacementMessage* replaceMsg );
00085         void handleReleaseIntermediate( PubSubReleaseIntermediateMessage* releaseMsg );
00086         void handleIntermediateBackup( PubSubBackupIntermediateMessage* backupMsg );
00087         void handleSubscriptionBackup( PubSubBackupSubscriptionMessage* backupMsg );
00088         void handleUnsubscribeBackup( PubSubBackupUnsubscribeMessage* backupMsg );
00089 
00090         void unsubscribeChild( const NodeHandle& node, PubSubSubspaceResponsible& subspace );
00091         void sendMessageToChildren( PubSubSubspaceResponsible& subspace,
00092                                         BaseOverlayMessage* toIntermediates,
00093                                         BaseOverlayMessage* toBackup,
00094                                         BaseOverlayMessage* toPlayers );
00095 
00096         void publishEvents();
00097         void startTimer( PubSubTimer* timer );
00098 
00099         std::list<PubSubSubspace> subscribedSubspaces;
00100         std::map<PubSubSubspaceId, PubSubSubspaceResponsible> responsibleSubspaces;
00101         std::map<PubSubSubspaceId, PubSubSubspaceResponsible> backupSubspaces;
00102         std::map<PubSubSubspaceId, PubSubSubspaceIntermediate> intermediateSubspaces;
00103 
00104         int subspaceSize;
00105         int AOIWidth;
00106 
00107         int numSubspaces;
00108         int parentTimeout;
00109         int maxChildren;
00110 
00111         bool allowOldMoveMessages;
00112 
00113         unsigned int currentRegionX, currentRegionY;
00114         int movementRate;
00115         int maxMoveDelay;
00116         PubSubTimer* heartbeatTimer;
00117         PubSubTimer* childPingTimer;
00118         PubSubTimer* eventDeliveryTimer;
00119         cMessage* joinTimer;
00120         TransportAddress lobbyServer;
00121 
00122         // statistics
00123         int numEventsWrongTimeslot;
00124         int numEventsCorrectTimeslot;
00125         int numPubSubSignalingMessages;
00126         int pubSubSignalingMessagesSize;
00127         int numMoveMessages;
00128         int moveMessagesSize;
00129         int numMoveListMessages;
00130         int moveListMessagesSize;
00131         int respMoveListMessagesSize;
00132         int lostMovementLists;
00133         int receivedMovementLists;
00134 };
00135 
00136 #endif
Generated on Wed May 26 16:21:15 2010 for OverSim by  doxygen 1.6.3