121 lines
3.3 KiB
C++
121 lines
3.3 KiB
C++
/*
|
|
* File: Application.h
|
|
* Author: jgaebler
|
|
*
|
|
* Created on July 22, 2010, 10:56 AM
|
|
*/
|
|
|
|
#ifndef APPLICATION_H
|
|
#define APPLICATION_H
|
|
|
|
#include "common/Defines.h"
|
|
#include "common/transport/TransportAddress.h"
|
|
#include "common/transport/TransportAddressList.h"
|
|
#include "event/ObjectListener.h"
|
|
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @brief Defines for each test application a value, configured within the omnet.ini files and moversight to
|
|
* select the test application to run.
|
|
*/
|
|
enum ApplicationType {
|
|
TEST_APPLICATION = 0,
|
|
SPLIT_TEST_APPLICATION,
|
|
NFD_TEST_APPLICATION,
|
|
PEER_PLACING_TEST_APPLICATION,
|
|
MERGE_TEST_APPLICATION,
|
|
ALM_TEST_APPLICATION, //5
|
|
PARTITION_APPLICATION,
|
|
PENDING_TEST_APPLICATION, //7
|
|
MAINTANCE_APPLICATION
|
|
};
|
|
|
|
class Moversight;
|
|
class Dispatcher;
|
|
|
|
class Invitation;
|
|
class PeerDescription;
|
|
class Peer;
|
|
|
|
class GroupData;
|
|
class StreamMessage;
|
|
class UnicastMessage;
|
|
|
|
/**
|
|
* @brief Defines a small test application interface to test the moversight protocol.
|
|
* @ingroup Moversight
|
|
* @class Application
|
|
* @author Jan Gäbler
|
|
* @author Rober Noack
|
|
*/
|
|
class Application : public ObjectListener {
|
|
public:
|
|
|
|
#if OMNETPP
|
|
Application(Moversight & m, std::string name);
|
|
#else
|
|
Application();
|
|
|
|
void setMoversight(Moversight * m);
|
|
#endif
|
|
|
|
Application& operator=(const Application & other);
|
|
|
|
virtual ~Application();
|
|
|
|
void setDispatcher(Dispatcher * d);
|
|
|
|
virtual void initialise();
|
|
virtual void finalise();
|
|
|
|
#if OMNETPP
|
|
/**
|
|
* @brief Starts the given test case.
|
|
* @param i The number of the test case to start.
|
|
*/
|
|
virtual void startTestCase(unsigned int i) = 0;
|
|
|
|
virtual void receiveGroupData(const GroupData & data, const PeerID sender);
|
|
virtual void receiveStreamMessage(const StreamMessage & data, const PeerID sender);
|
|
virtual void receiveUnicastMessage(const UnicastMessage & data, const PeerID sender);
|
|
|
|
#endif
|
|
|
|
protected:
|
|
/**
|
|
* @brief A reference to the moversight module, used to retrieve module information as the local transport address.
|
|
*/
|
|
#if OMNETPP
|
|
Moversight & module;
|
|
#else
|
|
Moversight * module;
|
|
#endif
|
|
|
|
/**
|
|
* @brief A reference to the moversight dispatcher, used to access all moversight methods and services.
|
|
*/
|
|
Dispatcher * dis;
|
|
|
|
/**
|
|
* @brief Stores the transport addresses of the peers to invite.
|
|
*/
|
|
TransportAddressList candidates;
|
|
|
|
/**
|
|
* @brief The points to the current peer to invite within the candidates list.
|
|
*/
|
|
size_t candidatesIndex;
|
|
|
|
/**
|
|
* @brief Signals, if the application is within its initialization phase. True, the app is within the initialise phase, false otherwise.
|
|
*/
|
|
bool initApp;
|
|
};
|
|
}
|
|
}
|
|
#endif /* APPLICATION_H */
|
|
|