92 lines
2.6 KiB
C++
92 lines
2.6 KiB
C++
/*
|
|
* File: NetworkFailureDetector.h
|
|
* Author: jgaebler
|
|
*
|
|
* Created on July 31, 2012, 9:42 AM
|
|
*/
|
|
#pragma once
|
|
|
|
#ifndef NETWORKFAILUREDETECTOR_H
|
|
#define NETWORKFAILUREDETECTOR_H
|
|
|
|
#include "common/MoversightService.h"
|
|
|
|
#include "fd/nfd/suspicion/PeerSuspicionTable.h"
|
|
#include "fd/nfd/timer/DetectionTimer.h"
|
|
#include "common/timer/ReferenceTimerQueue.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @class NetworkFailureDetector
|
|
* @ingroup Moversight
|
|
* @author Jan Gäbler
|
|
* @brief Defines a base class for a network failure detector for the moversight
|
|
* failure detector service.
|
|
*/
|
|
class NetworkFailureDetector : public MoversightService {
|
|
public:
|
|
|
|
NetworkFailureDetector(Dispatcher & d);
|
|
NetworkFailureDetector(const NetworkFailureDetector & orig);
|
|
|
|
virtual ~NetworkFailureDetector();
|
|
|
|
NetworkFailureDetector & operator=(const NetworkFailureDetector & other);
|
|
|
|
/**
|
|
* @brief Starts the failure detection
|
|
*/
|
|
virtual void start();
|
|
|
|
/**
|
|
* @brief Stops the failure detection
|
|
*/
|
|
virtual void stop();
|
|
|
|
/**
|
|
* @brief Handles a detection timer timeout.
|
|
* @param timer The timer to handle.
|
|
*/
|
|
virtual void handleDetectionTimer(DetectionTimer * timer) = 0;
|
|
|
|
/**
|
|
* @brief Handles ongoing in-group traffic to derive peer state information.
|
|
* @param pdu The received message.
|
|
*/
|
|
virtual void handleMessage( const MoversightMessage * pdu) = 0;
|
|
|
|
virtual bool isRunning() const;
|
|
|
|
protected:
|
|
|
|
virtual void setRunning(bool Running);
|
|
|
|
virtual void startMonitorPeersAsMaster() = 0;
|
|
virtual void startMonitorPeersAsSlave() = 0;
|
|
|
|
/**
|
|
* @brief This stops the monitoring off all peers, register within the
|
|
* nfd.
|
|
*
|
|
* This method stops and removes all detection timer.
|
|
*/
|
|
virtual void stopMonitorAllPeers() = 0;
|
|
|
|
virtual bool isTargetPeer(const PeerID & pId);
|
|
|
|
virtual void sendControlMessage(const PeerID & pId);
|
|
virtual void sendControlMessageConfirm(const PeerID & pId);
|
|
|
|
bool running;
|
|
PeerSuspicionTable nfdStateTable;
|
|
ReferenceTimerQueue<PeerID, DetectionTimer * > detectionTimerQueue;
|
|
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif /* NETWORKFAILUREDETECTOR_H */
|
|
|