FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
ns_reserved::ns_permissions Namespace Reference

Permission bitfield management in reserved space. More...

Classes

class  Permissions
 Manages FlatImage permissions stored in reserved space. More...
 

Typedefs

using Bits = uint64_t
 

Functions

 ENUM (Permission, ALL, HOME, MEDIA, AUDIO, WAYLAND, XORG, DBUS_USER, DBUS_SYSTEM, UDEV, USB, INPUT, GPU, NETWORK, DEV, SHM, OPTICAL)
 
Value< void > bit_set (Bits &bits, Permission const &permission, bool value) noexcept
 Sets a bit permission with the target value.
 
std::set< std::string > to_strings (Bits const &bits) noexcept
 Creates a set of lowercase string permission representations.
 
Value< void > write (fs::path const &path_file_binary, Bits const &bits) noexcept
 Write the Bits struct to the given binary.
 
Value< Bits > read (fs::path const &path_file_binary) noexcept
 Read the Bits struct from the given binary.
 

Variables

std::map< Permission, Bits > const permission_mask
 

Detailed Description

Permission bitfield management in reserved space.

This namespace manages the sandboxing permissions. It provides operations for setting, adding, removing, and querying permissions such as X11, Wayland, network, GPU, audio, home directory access, USB, Bluetooth, and more. Permissions default to zero (no access), and must be explicitly granted by the user.

Typedef Documentation

◆ Bits

using ns_reserved::ns_permissions::Bits = uint64_t

Definition at line 41 of file permissions.hpp.

Function Documentation

◆ bit_set()

Value< void > ns_reserved::ns_permissions::bit_set ( Bits & bits,
Permission const & permission,
bool value )
inlinenodiscardnoexcept

Sets a bit permission with the target value.

Parameters
bitsPermission bits
permissionPermission to change in the bits
valueValue to set the target permission
Returns
Value<void> Nothing on success, or the respective error

Definition at line 74 of file permissions.hpp.

◆ read()

Value< Bits > ns_reserved::ns_permissions::read ( fs::path const & path_file_binary)
inlinenoexcept

Read the Bits struct from the given binary.

Parameters
path_file_binaryBinary which to read the Bits struct from
Returns
The Bits struct on success, or the respective error

Definition at line 126 of file permissions.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_strings()

std::set< std::string > ns_reserved::ns_permissions::to_strings ( Bits const & bits)
inlinenodiscardnoexcept

Creates a set of lowercase string permission representations.

Parameters
bitsPermission bits
Returns
std::set<std::string> The string permission list

Definition at line 90 of file permissions.hpp.

◆ write()

Value< void > ns_reserved::ns_permissions::write ( fs::path const & path_file_binary,
Bits const & bits )
inlinenoexcept

Write the Bits struct to the given binary.

Parameters
path_file_binaryBinary in which to write the Bits struct
bitsThe bits struct to write into the binary
Returns
Value<void> Nothing on success, or the respective error

Definition at line 112 of file permissions.hpp.

Here is the call graph for this function:

Variable Documentation

◆ permission_mask

std::map<Permission,Bits> const ns_reserved::ns_permissions::permission_mask
inline
Initial value:
=
{
{Permission::HOME, Bits{1} << 0},
{Permission::MEDIA, Bits{1} << 1},
{Permission::AUDIO, Bits{1} << 2},
{Permission::WAYLAND, Bits{1} << 3},
{Permission::XORG, Bits{1} << 4},
{Permission::DBUS_USER, Bits{1} << 5},
{Permission::DBUS_SYSTEM, Bits{1} << 6},
{Permission::UDEV, Bits{1} << 7},
{Permission::USB, Bits{1} << 8},
{Permission::INPUT, Bits{1} << 9},
{Permission::GPU, Bits{1} << 10},
{Permission::NETWORK, Bits{1} << 11},
{Permission::DEV, Bits{1} << 12},
{Permission::SHM, Bits{1} << 13},
{Permission::OPTICAL, Bits{1} << 14},
}

Definition at line 47 of file permissions.hpp.