blob: 4edbe35d86ebb0b7314e586584561aa5f4d1358d [file] [log] [blame]
Christopher Meis26fbbd52025-03-26 14:55:06 +01001#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
11namespace probe
12{
13struct 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
22enum class probe_type_codes
23{
24 FALSE_T,
25 TRUE_T,
26 AND,
27 OR,
28 FOUND,
29 MATCH_ONE
30};
31
Amithash Prasad60618a72025-05-13 11:03:02 -070032using FoundProbeTypeT = std::optional<probe_type_codes>;
Christopher Meis26fbbd52025-03-26 14:55:06 +010033
34FoundProbeTypeT findProbeType(const std::string& probe);
35
36// this class finds the needed dbus fields and on destruction runs the probe
37struct 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