dmi_filter_match
Synopsis
#include <opendmi/filter.h>
bool dmi_filter_match(const dmi_filter_t *filter, const dmi_entity_t *entity);
bool dmi_filter_is_empty(const dmi_filter_t *filter);
Description
The dmi_filter_match function tells whether a structure meets a filter,
see dmi_filter_create, which is the case if it meets both conditions:
-
Every category of the structure is in the mask of the filter. A structure found at a type number below 128 is a common one, which requires
DMI_FILTER_MASK_COMMON, and one found at 128 or above an OEM-specific one, which requiresDMI_FILTER_MASK_OEM. An inactive structure (type 126) requiresDMI_FILTER_MASK_INACTIVEas well, and a structure of no known type, which no specification decodes, requiresDMI_FILTER_MASK_UNKNOWN. -
The structure matches an entry of any of the lists of the filter: its handle is in the list of handles, its type number in the list of type numbers, or its specification belongs to a module of the list of modules, see
dmi_filter_add_type. A filter whose lists are empty matches every structure which meets its mask.
The dmi_filter_is_empty function tells whether the lists of handles, type
numbers and modules of a filter are all empty. The mask is not taken into
account.
An iterator checks the structures with dmi_filter_match, see
dmi_registry_iter_initialize, and takes no filter for one which matches every
structure. dmi_filter_match itself matches nothing with no filter.
Return value
dmi_filter_match returns true if the structure meets the filter, and
false otherwise, or if filter or entity is nullptr.
dmi_filter_is_empty returns true if the lists of the filter are empty,
or if filter is nullptr, and false otherwise.