Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
control_trusted_host_inventory.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <chrono>
6#include <cstddef>
7#include <cstdint>
8#include <filesystem>
9#include <functional>
10#include <memory>
11#include <optional>
12#include <string>
13#include <string_view>
14#include <vector>
15
16namespace pulp::inspect {
17
31
33
35 std::filesystem::path executable;
36 std::vector<std::string> arguments;
37 std::filesystem::path working_directory;
40 const ControlTrustedHostLaunchIntent&) = default;
41};
42
44 std::filesystem::path staging_root;
45 std::uint64_t broker_generation = 0;
46 std::size_t maximum_entries = 64;
47 std::size_t maximum_executable_bytes = 512u * 1024u * 1024u;
48 std::size_t maximum_manifest_bytes = 1024u * 1024u;
49 std::chrono::milliseconds ttl = std::chrono::seconds(10);
50};
51
53 std::string inventory_id;
54 std::chrono::steady_clock::time_point expires_at;
55};
56
61
70
76
78 std::string executable_digest;
79 std::string manifest_digest;
81 std::vector<ControlTrustedHostRuntimeDependencyPolicy> runtime_dependencies;
82 std::uint64_t working_directory_device = 0;
83 std::uint64_t working_directory_inode = 0;
84};
85
88std::optional<ControlTrustedHostPreparationPolicy>
90
95 public:
101
102 const std::filesystem::path& executable() const;
103 const std::vector<std::string>& arguments() const;
104 const std::filesystem::path& working_directory() const;
111 std::uint64_t broker_generation() const;
112 std::chrono::steady_clock::time_point expires_at() const;
113
114 private:
115 struct Impl;
116 explicit ControlTrustedHostSnapshot(std::unique_ptr<Impl> impl);
118 std::unique_ptr<Impl> impl_;
119};
120
126 public:
127 using Clock = std::function<std::chrono::steady_clock::time_point()>;
128
131 Clock clock = [] { return std::chrono::steady_clock::now(); });
135
139 const ControlTrustedHostLaunchIntent& intent,
140 std::optional<ControlTrustedHostPreparationPolicy> policy = std::nullopt);
141 std::optional<ControlTrustedHostSnapshot> consume(std::string_view inventory_id);
142 std::size_t sweep();
143 std::size_t size() const;
144
145 private:
146 struct Impl;
147 std::unique_ptr<Impl> impl_;
148};
149
150} // namespace pulp::inspect
std::optional< ControlTrustedHostSnapshot > consume(std::string_view inventory_id)
ControlTrustedHostInventory & operator=(const ControlTrustedHostInventory &)=delete
ControlTrustedHostInventory(ControlTrustedHostInventoryConfig config, Clock clock=[] { return std::chrono::steady_clock::now();})
std::function< std::chrono::steady_clock::time_point()> Clock
Definition control_trusted_host_inventory.hpp:127
ControlTrustedHostInventory(const ControlTrustedHostInventory &)=delete
ControlTrustedHostInventoryPrepareResult prepare(const ControlTrustedHostLaunchIntent &intent, std::optional< ControlTrustedHostPreparationPolicy > policy=std::nullopt)
Raw snapshot preparation is available on macOS v1.
const std::vector< std::string > & arguments() const
ControlTrustedHostSnapshot(ControlTrustedHostSnapshot &&) noexcept
bool loaded_runtime_closure_matches_policy(const ControlPeerEvidence &process) const
const std::filesystem::path & executable() const
const std::filesystem::path & working_directory() const
std::chrono::steady_clock::time_point expires_at() const
const ControlTrustedHostStaticExpectation & static_expectation() const
friend class ControlTrustedHostInventory
Definition control_trusted_host_inventory.hpp:117
const ControlRegistrationRequest & registration() const
@ path
Definition scene_node.hpp:93
Definition agent_context.hpp:7
ControlHostTier
Definition control_identity.hpp:100
@ Standalone
Definition control_identity.hpp:102
std::optional< ControlTrustedHostPreparationPolicy > pin_control_trusted_host_preparation_policy(const ControlTrustedHostLaunchIntent &intent)
Pins the exact raw-host bytes, manifest, working directory, and adjacent native runtime closure selec...
ControlTrustedHostInventoryStatus
Definition control_trusted_host_inventory.hpp:18
@ ManifestInvalid
Definition control_trusted_host_inventory.hpp:25
@ Prepared
Definition control_trusted_host_inventory.hpp:19
@ UnsupportedArtifact
Definition control_trusted_host_inventory.hpp:22
@ PlatformUnavailable
Definition control_trusted_host_inventory.hpp:20
@ SignatureInvalid
Definition control_trusted_host_inventory.hpp:27
@ SnapshotFailed
Definition control_trusted_host_inventory.hpp:24
@ ArtifactInvalid
Definition control_trusted_host_inventory.hpp:26
@ UnsafePath
Definition control_trusted_host_inventory.hpp:23
@ InvalidRequest
Definition control_trusted_host_inventory.hpp:21
@ EntropyUnavailable
Definition control_connection_admission.hpp:46
std::string_view control_trusted_host_inventory_status_id(ControlTrustedHostInventoryStatus status)
@ ResourceExhausted
Definition control_admission.hpp:26
@ InvalidRequest
Definition control_admission.hpp:17
STL namespace.
Evidence observed by the local IPC carrier.
Definition control_identity.hpp:53
Definition control_identity.hpp:181
Definition control_trusted_host_inventory.hpp:43
std::size_t maximum_manifest_bytes
Definition control_trusted_host_inventory.hpp:48
std::size_t maximum_entries
Definition control_trusted_host_inventory.hpp:46
std::chrono::milliseconds ttl
Definition control_trusted_host_inventory.hpp:49
std::uint64_t broker_generation
Definition control_trusted_host_inventory.hpp:45
std::filesystem::path staging_root
Definition control_trusted_host_inventory.hpp:44
std::size_t maximum_executable_bytes
Definition control_trusted_host_inventory.hpp:47
Definition control_trusted_host_inventory.hpp:57
ControlTrustedHostInventoryStatus status
Definition control_trusted_host_inventory.hpp:58
std::optional< ControlTrustedHostInventoryTicket > ticket
Definition control_trusted_host_inventory.hpp:59
Definition control_trusted_host_inventory.hpp:52
std::string inventory_id
Definition control_trusted_host_inventory.hpp:53
std::chrono::steady_clock::time_point expires_at
Definition control_trusted_host_inventory.hpp:54
Definition control_trusted_host_inventory.hpp:34
ControlHostTier host_tier
Definition control_trusted_host_inventory.hpp:38
std::vector< std::string > arguments
Definition control_trusted_host_inventory.hpp:36
std::filesystem::path working_directory
Definition control_trusted_host_inventory.hpp:37
friend bool operator==(const ControlTrustedHostLaunchIntent &, const ControlTrustedHostLaunchIntent &)=default
std::filesystem::path executable
Definition control_trusted_host_inventory.hpp:35
Definition control_trusted_host_inventory.hpp:77
std::uint64_t working_directory_inode
Definition control_trusted_host_inventory.hpp:83
ControlTrustedHostStaticExpectation static_expectation
Definition control_trusted_host_inventory.hpp:80
std::uint64_t working_directory_device
Definition control_trusted_host_inventory.hpp:82
std::string executable_digest
Definition control_trusted_host_inventory.hpp:78
std::vector< ControlTrustedHostRuntimeDependencyPolicy > runtime_dependencies
Definition control_trusted_host_inventory.hpp:81
std::string manifest_digest
Definition control_trusted_host_inventory.hpp:79
Definition control_trusted_host_inventory.hpp:71
std::string digest
Definition control_trusted_host_inventory.hpp:73
std::string filename
Definition control_trusted_host_inventory.hpp:72
ControlTrustedHostStaticExpectation static_expectation
Definition control_trusted_host_inventory.hpp:74
Exact static-code expectation derived from the staged destination.
Definition control_trusted_host_inventory.hpp:65
std::string executable_identity
Definition control_trusted_host_inventory.hpp:66
std::string publisher_id
Definition control_trusted_host_inventory.hpp:67
bool library_validation
Definition control_trusted_host_inventory.hpp:68