dmi_entity_data

Synopsis

#include <opendmi/entity.h>

const void *dmi_entity_data(const dmi_entity_t *entity, const dmi_type_t *type);

Description

The dmi_entity_data function returns a pointer to the raw SMBIOS structure data, including the structure header. The entity type is verified against the expected type parameter before returning the data.

The type is the structure type of the specification the structure is decoded by, see dmi_type, rather than the number the structure is found at. Some vendors place structures defined by others at type numbers of their own, e.g. Dell moves Intel reference code structures 16 types down, and such a structure is still of the type of its original specification, since its data is laid out as that type expects, while dmi_entity_type_id returns the type number found in the table. Structures of different types sharing a type number, e.g. Intel vPro information and Lenovo ThinkVantage Technologies enablement, are told apart, so the pointer returned is always of the C type of type.

Parameters

entity

Entity descriptor.

type

Expected structure type, e.g. DMI_TYPE(cooling_device). If the entity is not of this type, the function returns nullptr and raises an error. Pass DMI_TYPE_ANY to skip type checking.

Return value

Returns a pointer to the raw SMBIOS structure data. The returned pointer must not be modified or freed by the caller. Returns nullptr if entity is nullptr or the entity type does not match type.

Errors

DMI_ERROR_ENTITY_TYPE_INVALID

Structure is not of type type.