HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
Table 11-5 Input and output parameters available to a filter index function
DescriptionData typeParameter name
Input and Output parameter. Pointer to the filter
object created by the factory function. For details,
refer to “Writing a filter factory function”.
void *SLAPI_PLUGIN_OBJECT
Output parameter. Query operator used by the
server to determine how to compare the keys
generated from SLAPI_PLUGIN_MR_VALUES
and SLAPI_PLUGIN_MR_INDEX_FN against keys
in the index. For a list of possible values for this
parameter, refer to “Query operators in matching
rules”.
intSLAPI_PLUGIN_MR_QUERY_OPERATOR
Output parameter. Official matching rule OID (if
any) specified in the extensible match filter.
char *SLAPI_PLUGIN_MR_OID
Output parameter. Attribute type (if any)
specified in the extensible match filter.
char *SLAPI_PLUGIN_MR_TYPE
Output parameter. Pointer to an array of berval
structures containing the values specified in the
extensible match filter.
struct berval **SLAPI_PLUGIN_MR_VALUES
Output parameter. Name of the function called
by the server to generate a list of keys used for
indexing a set of values.
void * (function
pointer)
SLAPI_PLUGIN_MR_INDEX_FN
11.4.7 Writing a filter matching function
The filter matching function has the following prototype:
#include "slapi-plugin.h"
typedef int (*mrFilterMatchFn) \
(void* filter, Slapi_Entry* entry, Slapi_Attr* attrs);
This function passes the following arguments:
filter is a pointer to the filter object.
entry is a pointer to the “Slapi_Entry” entry that should be compared against the filter.
attrs is the first Slapi_Attr attribute in the entry or in the set of DN attributes. (The extensible
match filter might specify that the attributes in the DN of an entry should also be included
in the search.)
This function will never be called for the same filter object concurrently. (If you plan to manipulate
global variables, remember that the server can call this function concurrently for different filter
objects.)
The filter matching function should perform the following tasks:
1. From the filter object, get the attribute type, the values, and the query operator.
2. Find the corresponding attribute in the attributes passed into the function. Remember to
search for subtypes of an attribute (for example, cn=lang-ja) in the filter and in the
attributes specified by attrs.
You can call the “slapi_attr_type_cmp()” function to compare the attribute in the filter against
the attributes passed in as arguments.
3. Using the query operator to determine how the values should be compared, compare the
values from the filter against the values in the attribute.
4. Return one of the following values:
0 if the values of the attribute match the value specified in the filter.
-1 if the values do not match.
An LDAP error code (a positive number) if an error occurred.
11.4 Handling extensible match filters 97