71 lines
1.8 KiB
C++
71 lines
1.8 KiB
C++
/*
|
|
* PeerplacingApplication.h
|
|
*
|
|
* Created on: Apr 26, 2011
|
|
* Author: gschneid
|
|
*/
|
|
|
|
#ifndef PEERPLACINGAPPLICATION_H_
|
|
#define PEERPLACINGAPPLICATION_H_
|
|
|
|
#include "Application.h"
|
|
|
|
#include "common/Defines.h"
|
|
#include "ms/PeerState.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
class Dispatcher;
|
|
class Moversight;
|
|
class Invitation;
|
|
|
|
/**
|
|
* @brief Defines a small test application to test the moversight protocoll.
|
|
* @ingroup Moversight
|
|
* @class TestApplication
|
|
* @author Grit Schneider
|
|
*/
|
|
class PeerplacingApplication : public Application {
|
|
public:
|
|
|
|
PeerplacingApplication(Moversight & m);
|
|
virtual ~PeerplacingApplication();
|
|
|
|
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 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);
|
|
|
|
private:
|
|
|
|
void testCase00();
|
|
void testCase01();
|
|
void testCase02();
|
|
|
|
void invitePeer(TransportAddress & ta);
|
|
void leaveGroup();
|
|
void sendData();
|
|
|
|
PeerState state;
|
|
|
|
int waitCounter;
|
|
int count;
|
|
};
|
|
}
|
|
}
|
|
#endif /* PEERPLACINGAPPLICATION_H_ */
|
|
|