1. Overview
The DistroUtils.hpp file is a Header-only platform detection utility in BastionGuard.
Provides normalized parsing of /etc/os-release, identifies Fedora/RHEL-family systems, and exposes compile-time/runtime checks for Chromium Embedded Framework availability.
The documentation below is generated from the supplied source and covers its API surface, runtime responsibilities, data flow, filesystem or command interactions, concurrency model, and security considerations.
2. Source Inventory
- Original path:
DistroUtils.hpp - Language: C++
- Source type:
.hpp - Line count: 68
- SHA-256:
db871ebd536175b0ab9018b7cb05305e6cf5e3f798c88ab0229765d513ae6948
3. Dependencies
The file declares the following compile-time dependencies:
C/C++ Runtime
algorithmcctypefstreamstringunordered_map
4. Types and Public Contract
No standalone class, structure, or enumeration is declared directly in this file.
Declared Public Members
std::string line;
5. API and Method Inventory
The following functions or methods are implemented in this file:
normalize_os_release_value(std::string value)– Removes quotes and lowercases an operating-system release value.read_os_release()– Parses/etc/os-releaseinto a key/value map.is_fedora_rhel_family()– Returns whether the current distribution belongs to the Fedora/RHEL family.cef_supported()– Applies the distribution policy for CEF support.cef_available()– Combines compile-time CEF availability with runtime support policy.
6. Functional Architecture
Operating-System Parsing
- Reads
/etc/os-releaseline by line and ignores empty lines, comments, and malformed entries. - Removes surrounding double quotes and normalizes values to lowercase.
- Recognizes Fedora, RHEL, AlmaLinux, and Rocky Linux identifiers.
CEF Capability Policy
BASTIONGUARD_HAS_CEFdefaults to1when no build-system value is supplied.cef_supported()disables CEF on the Fedora/RHEL family.cef_available()combines build-time availability with distribution support.
7. Operational Flow
- Read key/value pairs from
/etc/os-release. - Normalize values for case-insensitive comparison.
- Classify the distribution family.
- Combine the distribution policy with the build-time CEF capability flag.
8. Filesystem and External Command Surface
Referenced Absolute Paths
/etc/os-release
Commands or Security Primitives Referenced
sh
9. Concurrency and Lifecycle
The file contains no explicit worker-thread or callback-lifetime mechanism.
10. Security Considerations
- Distribution detection reads a trusted system file but should tolerate missing or malformed values.
- Build-time capability flags and runtime distribution policy jointly determine feature exposure.
11. Implementation Considerations
- This header defines the public or private class contract; behavior is implemented by the matching
.cppfile unless marked inline. - Because the functions are inline, every consumer compiles its own copy and receives the same platform policy.
12. Licensing and Branding
The source is distributed under the GNU General Public License version 3.
The source header identifies BastionGuard™ as a trademark and states that the name and branding are not licensed under the GPL.
The software is provided without warranty, including implied warranties of merchantability or fitness for a particular purpose.
