dmi_entity_string_ex

Synopsis

#include <opendmi/entity.h>

const char *dmi_entity_string_ex(
        const dmi_entity_t *entity,
        size_t              num,
        bool                raw);

static inline const char *dmi_entity_string(
        const dmi_entity_t *entity,
        dmi_string_t        num);

Description

The dmi_entity_string_ex function retrieves a string from the entity’s string table by its 1-based index. SMBIOS structures store variable-length text strings in an unformatted section following the formatted data; each string is referenced by a 1-based index.

When raw is false, the returned string is trimmed of leading and trailing whitespace. When raw is true, the original untrimmed string is returned.

The dmi_entity_string function is a convenience wrapper that calls dmi_entity_string_ex with raw set to false.

Parameters

entity

Entity descriptor.

num

1-based string index. The string section may contain more strings than can be referenced by dmi_string_t fields of the structure, so the index of dmi_entity_string_ex is not limited to 255.

raw

If true, return the raw (untrimmed) string. If false, return the trimmed version.

Return value

Returns a pointer to the requested string. The returned string must not be modified or freed by the caller. Returns nullptr if entity is nullptr, num is zero, or num exceeds the number of strings in the entity.

Errors

DMI_ERROR_STRING_NOT_FOUND

Structure has fewer strings than num.