94 lines
2.6 KiB
C++
94 lines
2.6 KiB
C++
/*
|
|
* File: PartitionApplication.h
|
|
* Author: gschneid
|
|
*
|
|
* Created on October 22, 2012, 11:09 AM
|
|
*/
|
|
#pragma once
|
|
|
|
#ifndef PARTITIONAPPLICATION_H
|
|
#define PARTITIONAPPLICATION_H
|
|
|
|
#include "Application.h"
|
|
|
|
#include "simutils/statistics/DurationStatisticRecorder.h"
|
|
#include "simutils/statistics/VectorStatisticRecorder.h"
|
|
#include "common/container/PeerIDList.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
class Dispatcher;
|
|
class Moversight;
|
|
class Invitation;
|
|
|
|
/**
|
|
* @class PartitionApplication
|
|
* @brief Defines a small test application to test the moversight protocol.
|
|
*
|
|
* @ingroup Moversight
|
|
* @author Jan Gäbler
|
|
*/
|
|
class PartitionApplication : public Application {
|
|
public:
|
|
|
|
PartitionApplication(Moversight & m);
|
|
virtual ~PartitionApplication();
|
|
|
|
virtual void initialise();
|
|
virtual void finalise();
|
|
|
|
void startTestCase(unsigned int i);
|
|
|
|
void receiveGroupData(const GroupData & data, const PeerID sender);
|
|
|
|
// Event handling
|
|
virtual void handleEvent(const GroupCreatedEvent & e);
|
|
|
|
virtual void handleEvent(const JoinRequestEvent & e);
|
|
virtual void handleEvent(const JoinConfirmEvent & e);
|
|
virtual void handleEvent(const JoinRejectedEvent & e);
|
|
virtual void handleEvent(const JoinAbortedEvent & e);
|
|
|
|
|
|
virtual void handleEvent(const PeerJoinedEvent & e);
|
|
virtual void handleEvent(const PendingPeersEvent & e);
|
|
virtual void handleEvent(const PeerReconnectedEvent & e);
|
|
virtual void handleEvent(const PeerLeftEvent & e);
|
|
|
|
virtual void handleEvent(const RejoinDoneEvent & e);
|
|
virtual void handleEvent(const RejoinFailedEvent & e);
|
|
|
|
virtual void handleEvent(const StartMeasuringEvent & e);
|
|
virtual void handleEvent(const StopMeasuringEvent & e);
|
|
|
|
private:
|
|
|
|
void testCase00();
|
|
|
|
void invitePeer(TransportAddress & ta);
|
|
void leaveGroup();
|
|
void sendData();
|
|
|
|
void createRoster();
|
|
TransportAddress getNewTransportAddress(int i);
|
|
|
|
void setPendings(PeerIDList & pIdList);
|
|
|
|
DurationStatisticRecorder rejoinSucessDuration;
|
|
DurationStatisticRecorder leaveDelay;
|
|
|
|
size_t waitCounter;
|
|
size_t groupSize;
|
|
size_t lastGroupSize;
|
|
|
|
int numberOfPeers;
|
|
int clusterSize;
|
|
int numberOfMobilePeers;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif /* PARTITIONAPPLICATION_H */
|
|
|