Rule.hpp

1. Overview

Rule engine data model. Declares operator types, rule metadata, matching APIs and the rule/alias loader.

The original source path is:

include/bsc/rule/Rule.hpp

2. Role in the Daemon

This file participates in the privileged BastionGuard Secure Connection daemon. It uses the shared bsc models and follows the daemon-wide fallback strategy: optional high-fidelity backends are used when available, while portable polling or stub behavior preserves service startup.


3. Namespaces

  • bsc::rule

4. Dependencies and Included Interfaces

  • bsc/model/Connection.hpp
  • map
  • optional
  • regex
  • string
  • vector

5. Declared Types

  • enum class OperatorType
  • struct Operator
  • struct Rule
  • class Loader

6. State and Data Members

The interface declares the following relevant state members:

  • std::string operand
  • std::string data
  • std::vector<Operator> list
  • std::string name
  • std::string description
  • Operator op
  • std::vector<Rule> rules_
  • std::map<std::string, std::vector<std::string>> aliases_

7. API and Functions

The file declares or implements the following callable entry points:

  • public: void load_aliases(const std::string& path)
  • void load_directory(const std::string& dir)
  • bool save_rule(const Rule& rule, const std::string& dir) const

8. Rule Model

Operator represents recursive predicates. Rule adds action, duration, enablement, precedence and logging behavior. Loader owns aliases and the ordered rule collection.


9. External Resources and Protocol Values

Relevant paths, endpoints, command names or policy values referenced by this file include:

  • bsc/model/Connection.hpp
  • allow

10. Implementation Considerations

  • The file follows the daemon-wide convention of returning status values or optional objects instead of making recoverable conditions fatal.

11. Source Metrics

MetricValue
File size1324 bytes
Lines49
Detected API entries3
Detected types4