dmi_entity_decode

Synopsis

#include <opendmi/entity.h>

bool dmi_entity_decode(dmi_entity_t *entity);

Description

The dmi_entity_decode function decodes an SMBIOS entity that was previously created with dmi_entity_create.

It looks up the entity specification by type, validates the minimum length constraint, allocates the decoded structure descriptor, and invokes the type-specific decode handler. After successful decoding, the decoded data can be retrieved with dmi_entity_info.

This function is idempotent: if decoding has already been performed, it returns true immediately without repeating the operation.

Parameters

entity

Entity descriptor.

Return value

Returns true on success, including when the entity has already been decoded or no decoder is registered for its type. Returns false on failure (e.g., if entity is nullptr, the minimum length constraint is violated, or the type-specific decoder fails).

Errors

DMI_ERROR_ENTITY_LENGTH_INVALID

Structure is shorter than its type requires.

DMI_ERROR_OUT_OF_MEMORY

Memory is exhausted.

DMI_ERROR_ENTITY_DECODE_FAILED

Structure cannot be decoded. Raised last on every failure of the decoder but the lack of memory, after the errors the decoder has raised.