|
libnmbs 1.0.0
|
Lightweight helpers for generating NATO confidentiality metadata. More...
Namespaces | |
| namespace | binding |
Classes | |
| struct | ConfidentialityLabel |
| Struct representation of the ADatP-4774 "Confidentiality Label". More... | |
| class | Error |
| A simple error container to use with nmbs::expected for communicating domain issues to function callers. More... | |
Typedefs | |
| template<typename T> | |
| using | Expected = std::expected<T, Error> |
| Convenience typedef to standardise usage of nmbs::error in all std::expected usages. | |
Enumerations | |
| enum | ExitCode { success = 0 , invalid_arguments = 1 , file_not_found = 10 , xmp_not_found = 11 , xmp_key_not_found = 12 , xml_could_not_parse = 13 , xml_could_not_create_xpath_context = 14 , no_label_present = 15 , no_binding_support = 16 , unknown_error = 99 } |
Functions | |
| std::string_view | version () noexcept |
| Returns the semantic version of the library. | |
| void | cleanup () |
| Free up any allocated memory and state to keep tools like Valgrind clean. | |
| Expected< std::string > | write_labels (const std::filesystem::path &path, const std::vector< ConfidentialityLabel > &confidentiality_labels, std::optional< binding::ProfileSupport > binding_support=std::nullopt) |
| Writes ADatP‑4778 binding information using the best possible binding profile. | |
| Expected< std::optional< binding::BindingInformation > > | read_binding (const std::filesystem::path &path, std::optional< binding::ProfileSupport > binding_support=std::nullopt) |
| Reads the full ADatP-4778 binding from the file. | |
| Expected< std::optional< std::string > > | read_binding_xml (const std::filesystem::path &path, std::optional< binding::ProfileSupport > binding_support=std::nullopt) |
| Reads the full ADatP-4778 binding from the file. | |
| Expected< void > | remove_binding (const std::filesystem::path &path, std::optional< binding::ProfileSupport > binding_support=std::nullopt) |
| Removes the ADatP-4778 binding from the file. | |
Lightweight helpers for generating NATO confidentiality metadata.
This namespace contains a compact set of utilities implementing the essential parts of the ADatP‑4774, ADatP‑4778, and STANAG 5636 specifications. The functions focus on producing valid confidentiality labels and binding information for files that are known to be not highly sensitive, enabling consistent tagging without the overhead of a full‑scale DLP or metadata processing framework.
The goal of this library is to provide a minimal, dependency‑free toolkit that makes it easy to attach correct, standards‑compliant metadata to low‑sensitivity artifacts—an important step in reducing the scope of data requiring strict handling in cybersecurity workflows.
| using nmbs::Expected = std::expected<T, Error> |
Convenience typedef to standardise usage of nmbs::error in all std::expected usages.
| enum nmbs::ExitCode |
The possible exit codes which any of the nmbs tools may produce. These may be used in library functions, and as return values for executables.
| void nmbs::cleanup | ( | ) |
Free up any allocated memory and state to keep tools like Valgrind clean.
This should be safe to call in the middle of an application, it will just delete caches and unregister namespaces etc. This may lead to increased function times in subsequent calls.
|
nodiscard |
Reads the full ADatP-4778 binding from the file.
Returns the full deserialised object. Note that if multiple bindings are present, only one will be returned and the precedence is not defined.
| path | to the file |
| binding_support | flags if already known. The presence of this parameter will save CPU cycles in determining the available binding method for the file. Use manually, or via nmbs::binding::support. |
|
nodiscard |
Reads the full ADatP-4778 binding from the file.
Returns the full XML packet in its raw XML form.
| path | to the file |
| binding_support | flags if already known. The presence of this parameter will save CPU cycles in determining the available binding method for the file. Use manually, or via nmbs::binding::support. |
| Expected< void > nmbs::remove_binding | ( | const std::filesystem::path & | path, |
| std::optional< binding::ProfileSupport > | binding_support = std::nullopt ) |
Removes the ADatP-4778 binding from the file.
| path | to the file |
| binding_support | flags if already known. The presence of this parameter will save CPU cycles in determining the available binding method for the file. Use manually, or via nmbs::binding::support. |
|
nodiscardnoexcept |
Returns the semantic version of the library.
Using standard semantic‑versioning format (MAJOR.MINOR.PATCH), for example 1.0.0. This value is embedded during the build, and will match the CMake version of the source code. This function will return a complete version, and never any suffix like "~beta". This is important to consider if you are working with beta and pre-release builds, as during beta phases any new API changes will be unstable and may change without the version changing.
|
nodiscard |
Writes ADatP‑4778 binding information using the best possible binding profile.
Embedded is preferred over Sidecar, and the presence of a Sidecar is ignored if embedding is possible. Furthermore, existing data will be overridden. You can attempt to force a specific profile by passing the flag in to the binding_support parameter. Check the return parameter for errors to see if it succeeded.
| path | to the image file to label. |
| confidentiality_labels | collection of labels to write to the file. |
| binding_support | flags if already known. The presence of this parameter will save CPU cycles in determining the available binding method for the file. Use manually, or via nmbs::binding::support. |