Base class for all specialized rule condition classes.
More...
#include <RuleCondition.hpp>
Base class for all specialized rule condition classes.
◆ RuleConditionBase() [1/3]
usbguard::RuleConditionBase::RuleConditionBase |
( |
const std::string & |
identifier, |
|
|
const std::string & |
parameter, |
|
|
bool |
negated = false |
|
) |
| |
Constructs new rule condition.
- Parameters
-
identifier | Identifier/name of rule condition. |
parameter | Parameter of rule condition. |
negated | Defines whether rule condition should be negated or not. Rule condition is defaultly not negated. |
◆ RuleConditionBase() [2/3]
usbguard::RuleConditionBase::RuleConditionBase |
( |
const std::string & |
identifier, |
|
|
bool |
negated = false |
|
) |
| |
Constructs new rule condition without a parameter.
- Parameters
-
identifier | Identifier/name of rule condition. |
negated | Defines whether rule condition should be negated or not. Rule condition is defaultly not negated. |
◆ RuleConditionBase() [3/3]
Constructs new rule condition with the same attributes as rhs.
- Parameters
-
rhs | Rule condition to copy. |
◆ ~RuleConditionBase()
usbguard::RuleConditionBase::~RuleConditionBase |
( |
| ) |
|
|
virtual |
◆ clone()
Implement cloning algorithm for this object.
- Returns
- Clone of this object.
◆ evaluate()
bool usbguard::RuleConditionBase::evaluate |
( |
const Rule & |
rule | ) |
|
Evaluate based on given rule.
Evaluation returns true if update(rule) succeeds or if this condition is negated then returns true if update(rule) does not succeed.
- Parameters
-
- Returns
- True if rule has been evaluated successfully, false otherwise.
- See also
- update()
◆ getImplementation() [1/2]
RuleConditionBase * usbguard::RuleConditionBase::getImplementation |
( |
const std::string & |
condition_string | ) |
|
|
static |
Parses given rule string and constructs new specialized rule condition object.
- Parameters
-
condition_string | String should be a valid rule string. |
- Returns
- Pointer to newly constructed specialized rule condition object.
- Exceptions
-
runtime_error | If given string is empty or does not contain a valid rule. |
◆ getImplementation() [2/2]
RuleConditionBase * usbguard::RuleConditionBase::getImplementation |
( |
const std::string & |
identifier, |
|
|
const std::string & |
parameter, |
|
|
bool |
negated |
|
) |
| |
|
static |
Constructs new specialized rule condition object based on given arguments.
- Parameters
-
identifier | Identifies what rule condition object should be constructed. |
parameter | Parameter of new rule condition. |
negated | Defines whether new rule condition is negated or not. |
- Returns
- Pointer to newly constructed specialized rule condition object.
- Exceptions
-
runtime_error | If identifier is not valid. |
◆ hasParameter()
bool usbguard::RuleConditionBase::hasParameter |
( |
| ) |
const |
Checks whether rule condition has parameter.
In other words, checks whether the parameter is not empty.
- Returns
- True if rule condition has parameter, false otherwise.
◆ identifier()
const std::string & usbguard::RuleConditionBase::identifier |
( |
| ) |
const |
Returns rule condition identifier/name.
- Returns
- rule condition identifier/name.
◆ init()
void usbguard::RuleConditionBase::init |
( |
Interface *const |
interface_ptr | ) |
|
|
virtual |
Initialization algorithm for this object.
- Parameters
-
interface_ptr | Pointer to the interface. |
◆ isNegated()
bool usbguard::RuleConditionBase::isNegated |
( |
| ) |
const |
Checks whether this rule condition is negated or not.
- Returns
- True if this rule condition is negated, false otherwise.
◆ parameter()
const std::string & usbguard::RuleConditionBase::parameter |
( |
| ) |
const |
Returns parameter of rule condition.
- Returns
- Parameter of rule condition.
◆ toRuleString()
const std::string usbguard::RuleConditionBase::toRuleString |
( |
| ) |
const |
Returns string representation of this rule condition.
- Format: [!]<identifier>[(<parameter>)]
- Example 1: !rule-evaluated
- Example 2: random(0.1666)
- Returns
- String representation of this rule condition.
◆ toString()
const std::string usbguard::RuleConditionBase::toString |
( |
| ) |
const |
Returns string representation of this rule condition.
- Format: [!]<identifier>[(<parameter>)]
- Example 1: !rule-evaluated
- Example 2: random(0.1666)
- Returns
- String representation of this rule condition.
◆ update()
virtual bool usbguard::RuleConditionBase::update |
( |
const Rule & |
rule | ) |
|
|
pure virtual |
Implement update algorithm for this object.
- Parameters
-
rule | You might want to update based on some rule. |
- Returns
- True if update is successful, false otherwise.
The documentation for this class was generated from the following files: