Manages a bundle of plugins.
More...
#include <bundle.h>
Manages a bundle of plugins.
This class handles loading, verifying, and managing a bundle of plugins. It supports signed and unsigned bundles, with optional signature verification.
- Example: Loading and using a plugin bundle
try {
if (
bundle.has(
"my_plugin")) {
std::cout <<
"Bundle author: " <<
bundle.getBundleAuthor() << std::endl;
std::cout <<
"Bundle version: " <<
bundle.getBundleVersion() << std::endl;
}
} catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
}
Manages a bundle of plugins.
Definition bundle.h:84
◆ PluginBundle() [1/8]
fourdst::plugin::bundle::PluginBundle::PluginBundle |
( |
const std::string & | filename | ) |
|
|
explicit |
Construct a new PluginBundle from a filename with default load policy.
- Parameters
-
[in] | filename | Path to the bundle file. |
◆ PluginBundle() [2/8]
fourdst::plugin::bundle::PluginBundle::PluginBundle |
( |
const char * | filename | ) |
|
|
explicit |
Construct a new PluginBundle from a C-style filename with default load policy.
- Parameters
-
[in] | filename | Path to the bundle file as a C-string. |
◆ PluginBundle() [3/8]
fourdst::plugin::bundle::PluginBundle::PluginBundle |
( |
const std::filesystem::path & | filename | ) |
|
|
explicit |
Construct a new PluginBundle from a filesystem path with default load policy.
- Parameters
-
[in] | filename | Path to the bundle file. |
◆ PluginBundle() [4/8]
fourdst::plugin::bundle::PluginBundle::PluginBundle |
( |
const std::string & | filename, |
|
|
PluginLoadPolicy | policy ) |
|
explicit |
Construct a new PluginBundle with a custom load policy.
- Parameters
-
[in] | filename | Path to the bundle file. |
[in] | policy | Load policy for ABI compatibility checks. |
◆ PluginBundle() [5/8]
fourdst::plugin::bundle::PluginBundle::PluginBundle |
( |
const char * | filename, |
|
|
PluginLoadPolicy | policy ) |
|
explicit |
Construct a new PluginBundle with a custom load policy from a C-string.
- Parameters
-
[in] | filename | Path to the bundle file as a C-string. |
[in] | policy | Load policy for ABI compatibility checks. |
◆ PluginBundle() [6/8]
fourdst::plugin::bundle::PluginBundle::PluginBundle |
( |
const std::filesystem::path & | filename, |
|
|
PluginLoadPolicy | policy ) |
|
explicit |
Construct a new PluginBundle with a custom load policy from a filesystem path.
- Parameters
-
[in] | filename | Path to the bundle file. |
[in] | policy | Load policy for ABI compatibility checks. |
◆ ~PluginBundle()
fourdst::plugin::bundle::PluginBundle::~PluginBundle |
( |
| ) |
|
|
default |
◆ PluginBundle() [7/8]
fourdst::plugin::bundle::PluginBundle::PluginBundle |
( |
const PluginBundle & | | ) |
|
|
delete |
◆ PluginBundle() [8/8]
fourdst::plugin::bundle::PluginBundle::PluginBundle |
( |
PluginBundle && | | ) |
|
|
delete |
◆ build_host_metadata()
void fourdst::plugin::bundle::PluginBundle::build_host_metadata |
( |
| ) |
|
|
private |
Build metadata about the host system.
◆ getBundleAuthor()
std::string fourdst::plugin::bundle::PluginBundle::getBundleAuthor |
( |
| ) |
const |
Get the bundle author.
- Returns
- std::string Author of the bundle.
◆ getBundleComment()
std::string fourdst::plugin::bundle::PluginBundle::getBundleComment |
( |
| ) |
const |
Get the bundle comment.
- Returns
- std::string Comment/description of the bundle.
◆ getBundledDatetime()
std::string fourdst::plugin::bundle::PluginBundle::getBundledDatetime |
( |
| ) |
const |
Get the bundle creation datetime.
- Returns
- std::string Datetime string when the bundle was created.
◆ getBundleVersion()
std::string fourdst::plugin::bundle::PluginBundle::getBundleVersion |
( |
| ) |
const |
Get the bundle version.
- Returns
- std::string Version string of the bundle.
◆ getHostABISignature()
std::string fourdst::plugin::bundle::PluginBundle::getHostABISignature |
( |
| ) |
|
|
staticnodiscardprivate |
Get the ABI signature of the host system.
- Returns
- std::string ABI signature string.
◆ getHostArchitecture()
std::string fourdst::plugin::bundle::PluginBundle::getHostArchitecture |
( |
| ) |
|
|
staticnodiscardprivate |
Get the architecture of the host system.
- Returns
- std::string Architecture string.
◆ getHostOperatingSystem()
std::string fourdst::plugin::bundle::PluginBundle::getHostOperatingSystem |
( |
| ) |
|
|
staticnodiscardprivate |
Get the operating system name of the host.
- Returns
- std::string Operating system name.
◆ getPluginNames()
std::vector< std::string > fourdst::plugin::bundle::PluginBundle::getPluginNames |
( |
| ) |
const |
Get a list of all plugin names in the bundle.
- Returns
- std::vector<std::string> List of plugin names.
◆ has()
bool fourdst::plugin::bundle::PluginBundle::has |
( |
const std::string & | pluginName | ) |
const |
Check if a plugin exists in the bundle.
- Parameters
-
[in] | pluginName | Name of the plugin to check. |
- Returns
- true If the plugin exists in the bundle.
-
false If the plugin does not exist in the bundle.
◆ isBundleSigned()
bool fourdst::plugin::bundle::PluginBundle::isBundleSigned |
( |
| ) |
const |
Check if the bundle is signed.
- Returns
- true If the bundle has a signature.
-
false If the bundle is not signed.
◆ isBundleTrusted()
bool fourdst::plugin::bundle::PluginBundle::isBundleTrusted |
( |
| ) |
const |
Check if the bundle is trusted.
A bundle is considered trusted if its signature is valid and the signing key is in the system's trusted keys.
- Returns
- true If the bundle is trusted.
-
false If the bundle is not trusted.
◆ load() [1/2]
void fourdst::plugin::bundle::PluginBundle::load |
( |
const std::string & | pluginName | ) |
const |
Load a plugin from the bundle.
- Parameters
-
[in] | pluginName | Name of the plugin to load. |
- Exceptions
-
std::runtime_error | If the plugin cannot be loaded. |
◆ load() [2/2]
void fourdst::plugin::bundle::PluginBundle::load |
( |
const std::vector< PluginPlatforms > & | plugins | ) |
const |
|
private |
Load plugins from the specified platforms.
- Parameters
-
[in] | plugins | List of platform-specific plugin information. |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ parse_manifest()
std::vector< PluginPlatforms > fourdst::plugin::bundle::PluginBundle::parse_manifest |
( |
std::filesystem::path | manifestPath | ) |
|
|
private |
Parse the bundle manifest.
- Parameters
-
[in] | manifestPath | Path to the manifest file. |
- Returns
- std::vector<PluginPlatforms> List of platform-specific plugin information.
- Exceptions
-
std::runtime_error | If the manifest is invalid or missing required fields. |
◆ unpackBundle()
void fourdst::plugin::bundle::PluginBundle::unpackBundle |
( |
const std::filesystem::path & | archivePath, |
|
|
const utils::TemporaryDirectory & | temporaryDirectory ) |
|
staticprivate |
Unpack a bundle to a temporary directory.
- Parameters
-
[in] | archivePath | Path to the bundle archive. |
[in] | temporaryDirectory | Temporary directory to extract to. |
- Exceptions
-
std::runtime_error | If unpacking fails. |
◆ verify_bundle()
bool fourdst::plugin::bundle::PluginBundle::verify_bundle |
( |
| ) |
|
|
private |
Verify the bundle's signature.
- Returns
- true If the bundle's signature is valid.
-
false If the bundle's signature is invalid or missing.
◆ m_bundleAuthor
std::string fourdst::plugin::bundle::PluginBundle::m_bundleAuthor |
|
private |
◆ m_bundleAuthorKeyFingerprint
std::optional<std::string> fourdst::plugin::bundle::PluginBundle::m_bundleAuthorKeyFingerprint |
|
private |
Fingerprint of the signing key.
◆ m_bundleComment
std::string fourdst::plugin::bundle::PluginBundle::m_bundleComment |
|
private |
Comment/description of the bundle.
◆ m_bundledDatetime
std::string fourdst::plugin::bundle::PluginBundle::m_bundledDatetime |
|
private |
When the bundle was created.
◆ m_bundleManifest
YAML::Node fourdst::plugin::bundle::PluginBundle::m_bundleManifest |
|
private |
◆ m_bundleName
std::string fourdst::plugin::bundle::PluginBundle::m_bundleName |
|
private |
◆ m_bundleSignature
std::optional<std::vector<unsigned char> > fourdst::plugin::bundle::PluginBundle::m_bundleSignature |
|
private |
◆ m_bundleVersion
std::string fourdst::plugin::bundle::PluginBundle::m_bundleVersion |
|
private |
◆ m_filepath
std::filesystem::path fourdst::plugin::bundle::PluginBundle::m_filepath |
|
private |
◆ m_hostABISignature
std::string fourdst::plugin::bundle::PluginBundle::m_hostABISignature |
|
private |
ABI signature of the host system.
◆ m_hostArchitecture
std::string fourdst::plugin::bundle::PluginBundle::m_hostArchitecture |
|
private |
Architecture of the host system.
◆ m_hostOperatingSystem
std::string fourdst::plugin::bundle::PluginBundle::m_hostOperatingSystem |
|
private |
Operating system of the host.
◆ m_loadedMap
std::unordered_map<std::string, bool> fourdst::plugin::bundle::PluginBundle::m_loadedMap |
|
private |
◆ m_loadPolicy
◆ m_pluginAuthors
std::unordered_map<std::string, std::string> fourdst::plugin::bundle::PluginBundle::m_pluginAuthors |
|
private |
Map of plugin names to authors.
◆ m_pluginManager
Reference to the plugin manager.
◆ m_pluginNames
std::vector<std::string> fourdst::plugin::bundle::PluginBundle::m_pluginNames |
|
private |
List of plugin names in the bundle.
◆ m_pluginVersions
std::unordered_map<std::string, std::string> fourdst::plugin::bundle::PluginBundle::m_pluginVersions |
|
private |
Map of plugin names to versions.
◆ m_signed
bool fourdst::plugin::bundle::PluginBundle::m_signed |
|
private |
Whether the bundle is signed.
◆ m_temporaryDirectory
Temporary directory for bundle extraction.
◆ m_triplet
std::string fourdst::plugin::bundle::PluginBundle::m_triplet |
|
private |
System triplet (e.g., x86_64-linux-gnu)
◆ m_trusted
bool fourdst::plugin::bundle::PluginBundle::m_trusted |
|
private |
Whether the bundle is trusted.
The documentation for this class was generated from the following files: