dmi_type_spec
Synopsis
#include <opendmi/entity.h>
const dmi_entity_spec_t *dmi_type_spec(dmi_context_t *context, dmi_type_id_t type);
Description
The dmi_type_spec function returns the specification which decodes the
structures found at the type number type in a context.
Every context maps the type numbers to specifications: the standard ones are
mapped when the context is created, and the ones of the vendor modules when
the modules are enabled, explicitly by dmi_add_extension, or for the
platform the data comes from by dmi_open and dmi_set_platform.
Vendor modules map their specifications to OEM numbers, and may relocate them
to other numbers than the ones they are declared with, so the type member
of the specification may tell another number than type. The modules enabled
for a platform are disabled again by dmi_close, so the specification a
number is mapped to may be different before the data is read and after it.
A number may be mapped to several specifications at once, which are told
apart by the signatures of the structures, see dmi_signature_t, and are
chosen for each structure as it is decoded. Such a number is represented by
the specification without a signature, or by the first one with a signature
if all of them have one. The specification a structure has actually been
decoded by is the spec member of the entity.
Specifications are constant data of the library and of its modules, so the one returned stays valid as long as the library is loaded, whatever the mapping becomes later.
Parameters
context-
Context the type number is looked up in.
type-
Type number to look up, see
dmi_type_id.
Return value
Returns the specification, or nullptr if context is nullptr, if no
specification is mapped to the number, e.g. a number of a module which is
not enabled or a number the specification does not assign yet, or if the
number is out of range.