Handling Extensible Match FiltersChapter 11 Writing Matching Rule Plug-ins 149Writing a Filter Matching FunctionThe 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 againstthe filter.• attrs is the first Slapi_Attr attribute in the entry or in the set of DNattributes. (The extensible match filter might specify that the attributes in theDN of an entry should also be included in the search.)This function will never be called for the same filter object concurrently. (If youplan to manipulate global variables, keep in mind that the server can call thisfunction concurrently for different filter objects.)The filter matching function should do the following: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.Make sure to check for subtypes of an attribute (for example, cn=lang-ja) inthe filter and in the attributes specified by attrs.SLAPI_PLUGIN_MR_TYPE char * Output parameter. Attribute type (ifany) specified in the extensiblematch filter.SLAPI_PLUGIN_MR_VALUES struct berval ** Output parameter. Pointer to anarray of berval structurescontaining the values specified inthe extensible match filter.SLAPI_PLUGIN_MR_INDEX_FN void *(function pointer)Output parameter. Name of thefunction called by the server togenerate a list of keys used forindexing a set of values.Table 11-5 Input and Output Parameters Available to a Filter Index Function (Continued)Parameter Name Data Type Description