KBRTestApp.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 __KBRTESTAPP_H_
00025 #define __KBRTESTAPP_H_
00026 
00027 #include <omnetpp.h>
00028 
00029 #include <OverlayKey.h>
00030 
00031 #include "BaseApp.h"
00032 
00033 class KBRTestMessage;
00034 
00042 class KBRTestApp : public BaseApp
00043 {
00044 public:
00045     KBRTestApp();
00046     ~KBRTestApp();
00047 
00048 private:
00049 
00054     struct MsgHandle
00055     {
00056         OverlayKey key;
00057         int seqNum;
00058 
00059         MsgHandle(void) :
00060             key(OverlayKey::UNSPECIFIED_KEY), seqNum(-1) {};
00061         MsgHandle(const OverlayKey& key, int seqNum) :
00062             key(key), seqNum(seqNum) {};
00063         bool operator==(const MsgHandle& rhs) const {
00064             return ((key == rhs.key) && (seqNum == rhs.seqNum));
00065         };
00066         MsgHandle& operator=(const MsgHandle& rhs) {
00067             key = rhs.key;
00068             seqNum = rhs.seqNum;
00069             return (*this);
00070         };
00071     };
00072     typedef std::vector<MsgHandle> MsgHandleBuf;
00073 
00074     void initializeApp(int stage);
00075     void finishApp();
00076     void handleTimerEvent(cMessage* msg);
00077 
00078     void deliver(OverlayKey& key, cMessage* msg);
00079 
00080     void forward(OverlayKey* key, cPacket** msg, NodeHandle* nextHopNode);
00081 
00091     bool checkSeen(const OverlayKey& key, int seqNum);
00092 
00103     void evaluateData(simtime_t timeDelay, int hopCount, long int bytes);
00104 
00105     void handleRpcResponse(BaseResponseMessage* msg, cPolymorphic* context,
00106                            int rpcId, simtime_t rtt);
00107 
00108     void handleLookupResponse(LookupResponse* msg);
00109 
00110     void pingResponse(PingResponse* response, cPolymorphic* context,
00111                       int rpcId, simtime_t rtt);
00112 
00113     // see BaseApp.h
00114     virtual void handleNodeLeaveNotification();
00115 
00116     double mean; 
00117     double deviation; 
00118     bool activeNetwInitPhase; 
00119     bool lookupNodeIds;  
00120     bool nodeIsLeavingSoon; 
00121 
00122     int numDelivered; 
00123     int bytesDelivered; 
00124     int numDropped;
00125     int bytesDropped;
00126 
00127     cMessage* testTimer;
00128     uint32_t sequenceNumber;
00129     int msgHandleBufSize; 
00130     MsgHandleBuf mhBuf; 
00131     MsgHandleBuf::iterator mhBufBegin; 
00132     MsgHandleBuf::iterator mhBufNext; 
00133     MsgHandleBuf::iterator mhBufEnd; 
00134 };
00135 
00136 #endif

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