Files
2014-06-30 13:58:10 +02:00

74 lines
2.3 KiB
C++

/*
* File: MessageValidator.h
* Author: jgaebler
*
* Created on May 11, 2011, 3:20 PM
*/
#pragma once
#ifndef MESSAGEVALIDATOR_H
#define MESSAGEVALIDATOR_H
#include "Dispatcher.h"
#include "ms/MembershipService.h"
namespace ubeeme {
namespace moversight {
class MoversightMessage;
class ExteriorMessage;
class MulticastMessage;
/**
* @class MessageValidator
* @author Jan Gäbler
* @ingroup Moversight
* @brief Defines an abstract interface to a message validator, that
* decides whether to process a received message or to drop it.
*/
class MessageValidator {
public:
/**
* @brief Constructor
* @param dis A reference to the dispatcher.
*/
MessageValidator( Dispatcher& dis) : dispatcher(dis), membershipService( dis.getMembershipService()) {
}
/**
* @brief Destructor
*/
virtual ~MessageValidator(){
}
/**
* @brief Checks, if the received interior message valid within the current group.
* @param msg The message to validate.
* @return True, if the received message checked as valid message within the current group, false otherwise.
*/
virtual bool isValid( const MoversightMessage & msg) const = 0;
/**
* @brief Checks, if the received multicast message valid within the current view, or not.
* @param msg The message to validate.
* @return True, if the received message checked as valid message within the current view, false otherwise.
*/
virtual bool isValid( const MulticastMessage & msg) const = 0;
/**
* @brief Checks, if the received exterior message valid within the current view, or not.
* @param msg The message to validate.
* @return True, if the received message checked as valid message within the current view, false otherwise.
*/
virtual bool isValid( const ExteriorMessage & msg) const = 0;
protected:
Dispatcher & dispatcher;
MembershipService& membershipService;
};
}
}
#endif /* MESSAGEVALIDATOR_H */