HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
5.7.1 Determining if an entry matches a filter
After retrieving a filter from the SLAPI_SEARCH_FILTER parameter of the parameter block,
you can call the “slapi_filter_test()” function to determine if entries in your database match the
filter.
5.7.2 Getting the filter type
To determine the type of filter that you are using, call the “slapi_filter_get_choice()” function.
This function returns the filter type, which can be any of the following values:
Table 5-4 Types of filters
DescriptionFilter type
Find entries that match all filters that are specified in this complex filter.
LDAP_FILTER_AND
Find entries that match any filter specified in this complex filter.
LDAP_FILTER_OR
Find entries that do not match the specified filter.
LDAP_FILTER_NOT
Find entries that contain a value equal to the specified attribute value.
LDAP_FILTER_EQUALITY
Find entries that contain a value that matches the specified substrings.
LDAP_FILTER_SUBSTRINGS
Find entries that contain a value greater than or equal to the specified attribute
value.
LDAP_FILTER_GE
Find entries that contain a value less than or equal to the specified attribute
value.
LDAP_FILTER_LE
Find entries that contain the specified attribute.
LDAP_FILTER_PRESENT
Find entries that contain a value approximately matching the specified
attribute value.
LDAP_FILTER_APPROX
5.7.3 Getting the search criteria
You can use the following functions to retrieve the search criteria specified by a search filter:
Table 5-5 Functions used to retrieve the search criteria specified by search filters
Use this function:For this filter type:
“slapi_filter_get_ava()”
LDAP_FILTER_EQUALITY
LDAP_FILTER_GE
LDAP_FILTER_LE
LDAP_FILTER_APPROX
“slapi_filter_get_type()”
LDAP_FILTER_PRESENT
“slapi_filter_get_subfilt()”
LDAP_FILTER_SUBSTRINGS
“slapi_filter_list_first()” and “slapi_filter_list_next()”
Both these functions will return either a filter component of the complex filter
or a NULL value, according to the following:
If slapi_list_first() returns a NULL, the complex filter is not of the
type LDAP_FILTER_AND, LDAP_FILTER_OR, or LDAP_FILTER_NOT.
If slapi_list_next() returns a NULL, the component returned by the
call is the last component in the complex filter.
LDAP_FILTER_AND
LDAP_FILTER_OR
LDAP_FILTER_NOT
5.7 Working with search filters 55