11.7. Writing an Initialization Function

Internally, the server keeps a list of matching rule plug-ins. When dealing with matching rules, the server attempts to find the matching rule plug-in to handle the given matching rule. Refer to Section 11.2.3, “How the Server Associates Plug-ins with OIDs”, for details.
In order to add your plug-in to that internal list, you need to write an initialization function. The initialization function takes a single Slapi_PBlock argument. The function should set the following parameters:
You need to register the initialization function so that the server runs the function when starting. For how to register matching rule functions, refer to Section 11.8, “Registering Matching Rule Functions”.
The following table summarizes the different parameters that the initialization function should get and set in the parameter block that is passed in.

Table 11.7. Input and Output Parameters Available to a Matching Rule Plug-in Initialization Function

Parameter Name Data Type Description
SLAPI_PLUGIN_ARGC int Input parameter. Number of arguments in the plugin directive, not including the library name and initialization function name.
SLAPI_PLUGIN_ARGV char ** Input parameter. Array of string arguments in the plugin directive, not including the library name and initialization function name.
SLAPI_PLUGIN_MR_FILTER_CREATE_FN void * (function pointer) Output parameter. The factory function used for creating filters.
SLAPI_PLUGIN_MR_INDEXER_CREATE_FN void * (function pointer) Output parameter. The factory function used for creating indexers.
SLAPI_PLUGIN_CLOSE_FN void * (function pointer) Output parameter. The close function, which the server calls before shutting down.
SLAPI_PLUGIN_PRIVATE void * Output parameter. Pointer to any private data you want passed to your plug-in functions.