blob: 0fdf674686a9f4d988d99da3997efb6d0ddb981e [file] [log] [blame]
Christopher Meis26fbbd52025-03-26 14:55:06 +01001#pragma once
2
3#include "perform_scan.hpp"
4
Ed Tanousdbf95b22025-10-13 11:38:35 -07005#include <flat_map>
Christopher Meis26fbbd52025-03-26 14:55:06 +01006#include <memory>
7#include <string>
8#include <vector>
9
10namespace probe
11{
Christopher Meis26fbbd52025-03-26 14:55:06 +010012
13// underscore T for collison with dbus c api
14enum class probe_type_codes
15{
16 FALSE_T,
17 TRUE_T,
18 AND,
19 OR,
20 FOUND,
21 MATCH_ONE
22};
23
Amithash Prasad60618a72025-05-13 11:03:02 -070024using FoundProbeTypeT = std::optional<probe_type_codes>;
Christopher Meis26fbbd52025-03-26 14:55:06 +010025
26FoundProbeTypeT findProbeType(const std::string& probe);
27
28// this class finds the needed dbus fields and on destruction runs the probe
Ed Tanous7f2fbf82025-10-14 15:39:28 -070029struct PerformProbe
Christopher Meis26fbbd52025-03-26 14:55:06 +010030{
31 PerformProbe(nlohmann::json& recordRef,
32 const std::vector<std::string>& probeCommand,
33 std::string probeName,
34 std::shared_ptr<scan::PerformScan>& scanPtr);
35 virtual ~PerformProbe();
36
Alexander Hansenb4c4e032025-08-05 17:59:07 +020037 private:
Christopher Meis26fbbd52025-03-26 14:55:06 +010038 nlohmann::json& recordRef;
39 std::vector<std::string> _probeCommand;
40 std::string probeName;
41 std::shared_ptr<scan::PerformScan> scan;
42};
43
44} // namespace probe