mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 19:24:26 +03:00
My 11th 2023 update
This commit is contained in:
30
components/security_apps/ips/include/rule_detection.h
Normal file
30
components/security_apps/ips/include/rule_detection.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef __RULE_DETECTION_H__
|
||||
#define __RULE_DETECTION_H__
|
||||
|
||||
#include "simple_protection.h"
|
||||
#include "compound_protection.h"
|
||||
|
||||
class RuleDetection
|
||||
{
|
||||
public:
|
||||
RuleDetection(const std::string &_sig_name) : sig_name(_sig_name) {}
|
||||
|
||||
template <typename T>
|
||||
void serialize(T &ar)
|
||||
{
|
||||
std::string type;
|
||||
ar(cereal::make_nvp("type", type));
|
||||
|
||||
if (type == "simple") rule = SimpleProtection::get(sig_name, ar);
|
||||
else if (type == "compound") rule = CompoundProtection::get(sig_name, ar);
|
||||
else reportConfigurationError("Unknown rule type: " + type);
|
||||
};
|
||||
|
||||
std::shared_ptr<IPSSignatureSubTypes::BaseSignature> getRule() { return rule; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<IPSSignatureSubTypes::BaseSignature> rule;
|
||||
std::string sig_name;
|
||||
};
|
||||
|
||||
#endif // __RULE_DETECTION_H__
|
Reference in New Issue
Block a user