diff --git a/userspace/engine/falco_engine.cpp b/userspace/engine/falco_engine.cpp index 6dc6f032..f976f527 100644 --- a/userspace/engine/falco_engine.cpp +++ b/userspace/engine/falco_engine.cpp @@ -907,6 +907,50 @@ bool falco_engine::is_source_valid(const std::string &source) const return m_sources.at(source) != nullptr; } +std::shared_ptr falco_engine::filter_factory_for_source(const std::string& source) +{ + return find_source(source)->filter_factory; +} + +std::shared_ptr falco_engine::filter_factory_for_source(std::size_t source_idx) +{ + return find_source(source_idx)->filter_factory; +} + +std::shared_ptr falco_engine::formatter_factory_for_source(const std::string& source) +{ + return find_source(source)->formatter_factory; +} + +std::shared_ptr falco_engine::formatter_factory_for_source(std::size_t source_idx) +{ + return find_source(source_idx)->formatter_factory; +} + +std::shared_ptr falco_engine::ruleset_factory_for_source(const std::string& source) +{ + return find_source(source)->ruleset_factory; +} + +std::shared_ptr falco_engine::ruleset_factory_for_source(std::size_t source_idx) +{ + return find_source(source_idx)->ruleset_factory; +} + +std::shared_ptr falco_engine::ruleset_for_source(const std::string& source_name) +{ + const falco_source *source = find_source(source_name); + + return source->ruleset; +} + +std::shared_ptr falco_engine::ruleset_for_source(std::size_t source_idx) +{ + const falco_source *source = find_source(source_idx); + + return source->ruleset; +} + void falco_engine::read_file(const std::string& filename, std::string& contents) { std::ifstream is; diff --git a/userspace/engine/falco_engine.h b/userspace/engine/falco_engine.h index d0df90fb..140bf220 100644 --- a/userspace/engine/falco_engine.h +++ b/userspace/engine/falco_engine.h @@ -242,6 +242,31 @@ public: // factory for this source. bool is_source_valid(const std::string &source) const; + // + // Given a source, return a formatter factory that can create + // filters for events of that source. + // + std::shared_ptr filter_factory_for_source(const std::string& source); + std::shared_ptr filter_factory_for_source(std::size_t source_idx); + + // + // Given a source, return a formatter factory that can create + // formatters for an event. + // + std::shared_ptr formatter_factory_for_source(const std::string& source); + std::shared_ptr formatter_factory_for_source(std::size_t source_idx); + + // + // Given a source, return a ruleset factory that can create + // rulesets for that source. + // + std::shared_ptr ruleset_factory_for_source(const std::string& source); + std::shared_ptr ruleset_factory_for_source(std::size_t source_idx); + + // Return the filter_ruleset used for a given source. + std::shared_ptr ruleset_for_source(const std::string& source); + std::shared_ptr ruleset_for_source(std::size_t source_idx); + // // Given an event source and ruleset, fill in a bitset // containing the event types for which this ruleset can run.