Skip to content

Commit

Permalink
chore(userspace/engine): renamings and code polishing in rule_loader …
Browse files Browse the repository at this point in the history
…and rule_reader

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
  • Loading branch information
jasondellaluce committed Apr 14, 2022
1 parent 7ead49a commit 802ab61
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 113 deletions.
26 changes: 13 additions & 13 deletions userspace/engine/falco_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,33 +150,33 @@ void falco_engine::load_rules(const string &rules_content, bool verbose, bool al

void falco_engine::load_rules(const string &rules_content, bool verbose, bool all_events, uint64_t &required_engine_version)
{
rule_loader::context ctx(rules_content);
ctx.engine = this;
ctx.min_priority = m_min_priority;
ctx.output_extra = m_extra;
ctx.replace_output_container_info = m_replace_container_info;
rule_loader::configuration cfg(rules_content);
cfg.engine = this;
cfg.min_priority = m_min_priority;
cfg.output_extra = m_extra;
cfg.replace_output_container_info = m_replace_container_info;

std::ostringstream os;
rule_reader reader;
bool success = reader.load(ctx, m_rule_loader);
bool success = reader.load(cfg, m_rule_loader);
if (success)
{
clear_filters();
m_rules.clear();
success = m_rule_loader.compile(ctx, m_rules);
success = m_rule_loader.compile(cfg, m_rules);
}
if (!ctx.errors.empty())
if (!cfg.errors.empty())
{
os << ctx.errors.size() << " errors:" << std::endl;
for(auto &err : ctx.errors)
os << cfg.errors.size() << " errors:" << std::endl;
for(auto &err : cfg.errors)
{
os << err << std::endl;
}
}
if (!ctx.warnings.empty())
if (!cfg.warnings.empty())
{
os << ctx.warnings.size() << " warnings:" << std::endl;
for(auto &warn : ctx.warnings)
os << cfg.warnings.size() << " warnings:" << std::endl;
for(auto &warn : cfg.warnings)
{
os << warn << std::endl;
}
Expand Down
Loading

0 comments on commit 802ab61

Please sign in to comment.