Skip to content

std.os.uefi.protocol.hii_database

Standard libraryZig 0.17.0Official documentation
Sourcestd/os/uefi/protocol/hii_database.zig

Source line 1

std.os.uefi.protocol.hii_database.cc

alias

Source line 6

Alias of std.os.uefi.cc

std.os.uefi.protocol.hii_database.Guid

alias

Source line 3

Alias of std.os.uefi.Guid

std.os.uefi.protocol.hii_database.hii

alias

Source line 5

Alias of std.os.uefi.hii

std.os.uefi.protocol.hii_database.HiiDatabase

container

Source line 9

Database manager for HII-related data structures.

Fields

_new_package_list: Status
_remove_package_list: *const fn (*HiiDatabase, hii.Handle) callconv(cc) Status
_update_package_list: *const fn (*HiiDatabase, hii.Handle, *const hii.PackageList) callconv(cc) Status
_list_package_lists: *const fn (*const HiiDatabase, u8, ?*const Guid, *usize, [*]hii.Handle) callconv(cc) Status
_export_package_lists: *const fn (*const HiiDatabase, ?hii.Handle, *usize, [*]hii.PackageList) callconv(cc) Status
_register_package_notify: Status
_unregister_package_notify: Status
_find_keyboard_layouts: Status
_get_keyboard_layout: Status
_set_keyboard_layout: Status
_get_package_list_handle: Status

std.os.uefi.protocol.hii_database.HiiDatabase.ExportPackageListError

error-set

Source line 33

Errors

BufferTooSmall
InvalidParameter
NotFound
Unexpected UnexpectedError

std.os.uefi.protocol.hii_database.HiiDatabase.exportPackageLists

function

Source line 87

Exports the contents of one or all package lists in the HII database into a buffer.

pub fn exportPackageLists( self: *const HiiDatabase, handle: ?hii.Handle, buffer: []hii.PackageList, ) ExportPackageListError![]hii.PackageList

Parameters

self: *const HiiDatabase
handle: ?hii.Handle
buffer: []hii.PackageList

Errors

BufferTooSmall
InvalidParameter
NotFound
Unexpected UnexpectedError

std.os.uefi.protocol.hii_database.HiiDatabase.guid

constant

Source line 102

std.os.uefi.protocol.hii_database.HiiDatabase.listPackageLists

function

Source line 64

Determines the handles that are currently active in the database.

pub fn listPackageLists( self: *const HiiDatabase, package_type: u8, package_guid: ?*const Guid, handles: []hii.Handle, ) ListPackageListsError![]hii.Handle

Parameters

self: *const HiiDatabase
package_type: u8
package_guid: ?*const Guid
handles: []hii.Handle

Errors

BufferTooSmall
InvalidParameter
NotFound
Unexpected UnexpectedError

std.os.uefi.protocol.hii_database.HiiDatabase.ListPackageListsError

error-set

Source line 28

Errors

BufferTooSmall
InvalidParameter
NotFound
Unexpected UnexpectedError

std.os.uefi.protocol.hii_database.HiiDatabase.removePackageList

function

Source line 40

Removes a package list from the HII database.

pub fn removePackageList(self: *HiiDatabase, handle: hii.Handle) RemovePackageListError!void

Parameters

self: *HiiDatabase
handle: hii.Handle

Errors

NotFound
Unexpected UnexpectedError

std.os.uefi.protocol.hii_database.HiiDatabase.RemovePackageListError

error-set

Source line 22

Errors

NotFound
Unexpected UnexpectedError

std.os.uefi.protocol.hii_database.HiiDatabase.updatePackageList

function

Source line 49

Update a package list in the HII database.

pub fn updatePackageList( self: *HiiDatabase, handle: hii.Handle, buffer: *const hii.PackageList, ) UpdatePackageListError!void

Parameters

self: *HiiDatabase
handle: hii.Handle
buffer: *const hii.PackageList

Errors

InvalidParameter
NotFound
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.hii_database.HiiDatabase.UpdatePackageListError

error-set

Source line 23

Errors

InvalidParameter
NotFound
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.hii_database.Status

alias

Source line 4

Alias of std.os.uefi.Status

std.os.uefi.protocol.hii_database.std

alias

Source line 1

Alias of std

std.os.uefi.protocol.hii_database.uefi

alias

Source line 2

Alias of std.os.uefi

Source code

std/os/uefi/protocol/hii_database.zig

const std = @import("std");
const uefi = std.os.uefi;
const Guid = uefi.Guid;
const Status = uefi.Status;
const hii = uefi.hii;
const cc = uefi.cc;

/// Database manager for HII-related data structures.
pub const HiiDatabase = extern struct {
    _new_package_list: Status, // TODO
    _remove_package_list: *const fn (*HiiDatabase, hii.Handle) callconv(cc) Status,
    _update_package_list: *const fn (*HiiDatabase, hii.Handle, *const hii.PackageList) callconv(cc) Status,
    _list_package_lists: *const fn (*const HiiDatabase, u8, ?*const Guid, *usize, [*]hii.Handle) callconv(cc) Status,
    _export_package_lists: *const fn (*const HiiDatabase, ?hii.Handle, *usize, [*]hii.PackageList) callconv(cc) Status,
    _register_package_notify: Status, // TODO
    _unregister_package_notify: Status, // TODO
    _find_keyboard_layouts: Status, // TODO
    _get_keyboard_layout: Status, // TODO
    _set_keyboard_layout: Status, // TODO
    _get_package_list_handle: Status, // TODO

    pub const RemovePackageListError = uefi.UnexpectedError || error{NotFound};
    pub const UpdatePackageListError = uefi.UnexpectedError || error{
        OutOfResources,
        InvalidParameter,
        NotFound,
    };
    pub const ListPackageListsError = uefi.UnexpectedError || error{
        BufferTooSmall,
        InvalidParameter,
        NotFound,
    };
    pub const ExportPackageListError = uefi.UnexpectedError || error{
        BufferTooSmall,
        InvalidParameter,
        NotFound,
    };

    /// Removes a package list from the HII database.
    pub fn removePackageList(self: *HiiDatabase, handle: hii.Handle) RemovePackageListError!void {
        switch (self._remove_package_list(self, handle)) {
            .success => {},
            .not_found => return error.NotFound,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// Update a package list in the HII database.
    pub fn updatePackageList(
        self: *HiiDatabase,
        handle: hii.Handle,
        buffer: *const hii.PackageList,
    ) UpdatePackageListError!void {
        switch (self._update_package_list(self, handle, buffer)) {
            .success => {},
            .out_of_resources => return error.OutOfResources,
            .invalid_parameter => return error.InvalidParameter,
            .not_found => return error.NotFound,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// Determines the handles that are currently active in the database.
    pub fn listPackageLists(
        self: *const HiiDatabase,
        package_type: u8,
        package_guid: ?*const Guid,
        handles: []hii.Handle,
    ) ListPackageListsError![]hii.Handle {
        var len: usize = handles.len;
        switch (self._list_package_lists(
            self,
            package_type,
            package_guid,
            &len,
            handles.ptr,
        )) {
            .success => return handles[0..len],
            .buffer_too_small => return error.BufferTooSmall,
            .invalid_parameter => return error.InvalidParameter,
            .not_found => return error.NotFound,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// Exports the contents of one or all package lists in the HII database into a buffer.
    pub fn exportPackageLists(
        self: *const HiiDatabase,
        handle: ?hii.Handle,
        buffer: []hii.PackageList,
    ) ExportPackageListError![]hii.PackageList {
        var len = buffer.len;
        switch (self._export_package_lists(self, handle, &len, buffer.ptr)) {
            .success => return buffer[0..len],
            .buffer_too_small => return error.BufferTooSmall,
            .invalid_parameter => return error.InvalidParameter,
            .not_found => return error.NotFound,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    pub const guid align(8) = Guid{
        .time_low = 0xef9fc172,
        .time_mid = 0xa1b2,
        .time_high_and_version = 0x4693,
        .clock_seq_high_and_reserved = 0xb3,
        .clock_seq_low = 0x27,
        .node = [_]u8{ 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 },
    };
};