Christopher Meis | 26fbbd5 | 2025-03-26 14:55:06 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "perform_scan.hpp" |
| 4 | |
| 5 | #include <boost/container/flat_map.hpp> |
| 6 | |
| 7 | #include <memory> |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | namespace probe |
| 12 | { |
| 13 | struct CmpStr |
| 14 | { |
| 15 | bool operator()(const char* a, const char* b) const |
| 16 | { |
| 17 | return std::strcmp(a, b) < 0; |
| 18 | } |
| 19 | }; |
| 20 | |
| 21 | // underscore T for collison with dbus c api |
| 22 | enum class probe_type_codes |
| 23 | { |
| 24 | FALSE_T, |
| 25 | TRUE_T, |
| 26 | AND, |
| 27 | OR, |
| 28 | FOUND, |
| 29 | MATCH_ONE |
| 30 | }; |
| 31 | |
Amithash Prasad | 60618a7 | 2025-05-13 11:03:02 -0700 | [diff] [blame^] | 32 | using FoundProbeTypeT = std::optional<probe_type_codes>; |
Christopher Meis | 26fbbd5 | 2025-03-26 14:55:06 +0100 | [diff] [blame] | 33 | |
| 34 | FoundProbeTypeT findProbeType(const std::string& probe); |
| 35 | |
| 36 | // this class finds the needed dbus fields and on destruction runs the probe |
| 37 | struct PerformProbe : std::enable_shared_from_this<PerformProbe> |
| 38 | { |
| 39 | PerformProbe(nlohmann::json& recordRef, |
| 40 | const std::vector<std::string>& probeCommand, |
| 41 | std::string probeName, |
| 42 | std::shared_ptr<scan::PerformScan>& scanPtr); |
| 43 | virtual ~PerformProbe(); |
| 44 | |
| 45 | nlohmann::json& recordRef; |
| 46 | std::vector<std::string> _probeCommand; |
| 47 | std::string probeName; |
| 48 | std::shared_ptr<scan::PerformScan> scan; |
| 49 | }; |
| 50 | |
| 51 | } // namespace probe |