HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
11.4.3 Writing a filter factory function
The filter factory function takes a single Slapi_PBlock argument. This function should be
thread-safe. The server may call this function concurrently. (Each incoming LDAP request is
handled by a separate thread. Multiple threads may call this function if processing multiple
requests that have extensible match filters.)
The filter factory function should perform the following tasks:
1. Get the OID from the SLAPI_PLUGIN_MR_OID parameter and determine whether that OID
is supported by your plug-in.
If the OID is not supported, you need to return the result code
LDAP_UNAVAILABLE_CRITICAL_EXTENSION. The server will send this back to the
client.
If the OID is supported, continue with this process.
2. Get and check the values of the SLAPI_PLUGIN_MR_TYPE and SLAPI_PLUGIN_MR_VALUE
parameters.
The values of these parameters are the attribute type and value specified in the extensible
match filter.
3. You can also get any data that you set in the SLAPI_PLUGIN_PRIVATE parameter during
initialization. Refer to “Writing an initialization function”.
4. Create a filter object, and include the following information:
The official OID of the matching rule. [Optional].
The attribute type specified in the filter.
The value specified in the filter.
Any additional data that you want made available to the filter index function (for
example, the query operator, if specified in the filter).
The server will call your filter index function at a later time to extract this information from
the filter object.
5. Set the following parameters:
Set the SLAPI_PLUGIN_MR_OID parameter to the official OID of the matching rule if
the value of that parameter is not the official OID. [Optional].
Set the SLAPI_PLUGIN_OBJECT parameter to the filter object.
Set the SLAPI_PLUGIN_MR_FILTER_INDEX_FN parameter to the filter index function
if you have set up indexes based on this matching rule. (cf. “Writing a filter index
function”) [Optional].
Set the SLAPI_PLUGIN_MR_FILTER_MATCH_FN parameter to the filter matching
function. Refer to “Writing a filter matching function”.
Set the SLAPI_PLUGIN_DESTROY_FN parameter to the function responsible for freeing
the filter object, if you have defined this function. [Optional]. Refer to “Writing a
destructor function”, for details.
6. Return 0 (or the result code LDAP_SUCCESS) if everything completed successfully.
11.4.4 Getting and setting parameters in filter factory functions
The following table summarizes the different parameters that the filter factory function should
get and set in the parameter block that is passed in.
11.4 Handling extensible match filters 95