93 lines
2.7 KiB
C++
93 lines
2.7 KiB
C++
/*
|
|
* File: SplitApplication.h
|
|
* Author: sgaebler
|
|
*
|
|
* Created on April 12, 2011, 04:37 PM
|
|
*/
|
|
|
|
#ifndef SPLITAPPLICATION_H
|
|
#define SPLITAPPLICATION_H
|
|
|
|
#include "Application.h"
|
|
|
|
#include "common/Defines.h"
|
|
#include "ms/PeerState.h"
|
|
#include "common/container/PeerIDList.h"
|
|
#include "simutils/statistics/DurationStatisticRecorder.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
class Dispatcher;
|
|
class Moversight;
|
|
class Invitation;
|
|
|
|
class SplitApplication : public Application {
|
|
public:
|
|
|
|
SplitApplication(Moversight & m);
|
|
virtual ~SplitApplication();
|
|
|
|
virtual void initialise();
|
|
virtual void finalise();
|
|
|
|
void startTestCase(unsigned int i);
|
|
|
|
// Event handling
|
|
virtual void handleEvent(const JoinRequestEvent & e);
|
|
virtual void handleEvent(const PeerJoinedEvent & e);
|
|
virtual void handleEvent(const JoinConfirmEvent & e);
|
|
virtual void handleEvent(const JoinRejectedEvent & e);
|
|
virtual void handleEvent(const JoinAbortedEvent & e);
|
|
virtual void handleEvent(const SplitDoneEvent & e);
|
|
virtual void handleEvent(const MergeRequestEvent & e);
|
|
virtual void handleEvent(const PendingPeersEvent & e);
|
|
virtual void handleEvent(const PeerReconnectedEvent & e);
|
|
virtual void handleEvent(const PeerLeftEvent & e);
|
|
|
|
void receiveGroupData(const GroupData & data, const PeerID sender);
|
|
|
|
private:
|
|
void testCase00();
|
|
void testCase01();
|
|
void testCase02();
|
|
void testCase03();
|
|
void testCase04();
|
|
void testCase05();
|
|
void testCase06();
|
|
void testCase07();
|
|
void testCase08();
|
|
|
|
PeerIDList getSpecifiedNumberOfPeers(bool mixed, int numberOfPeersToAdd, int numberOfClusters);
|
|
void invitePeer(TransportAddress & ta);
|
|
void leaveGroup();
|
|
void sendData();
|
|
void splitGroup(unsigned char options, PeerIDList splitPeers);
|
|
|
|
TransportAddress getNewTransportAddress(int i);
|
|
void createRoster(int nextPeerId, int numberOfClusters);
|
|
PeerIDList addToPeerIdList(PeerIDList pidl, int peersToAdd[], int numberOfPeersToAdd);
|
|
|
|
PeerState state;
|
|
|
|
bool splitOnce;
|
|
|
|
int waitCounter;
|
|
|
|
int splitCase;
|
|
|
|
#if OMNETPP
|
|
cOutVector splitDuration;
|
|
|
|
DurationStatisticRecorder joinDelayStat;
|
|
simtime_t dt;
|
|
unsigned int numberOfPeers;
|
|
unsigned int numberOfClusters;
|
|
#endif
|
|
|
|
};
|
|
}
|
|
}
|
|
#endif /* SPLITAPPLICATION_H */
|
|
|