Sun Java System Directory Server Enterprise Edition 6.1 Developer's Guide

Initializing the Computed Attribute Plug-In

Plug-ins that compute attribute values register the functions of type slapi_compute_callback_t to compute attributes with slapi_compute_add_evaluator() during initialization with the server.

#include "slapi-plugin.h"

int
compute_init(Slapi_PBlock * pb)
{
    int rc = 0;                        /* 0 means success             */
    rc |= slapi_pblock_set(            /* Plug-in API version         */
        pb,
        SLAPI_PLUGIN_VERSION,
        SLAPI_PLUGIN_CURRENT_VERSION
    );
    rc |= slapi_pblock_set(            /* Plug-in description         */
        pb,
        SLAPI_PLUGIN_DESCRIPTION,
        (void *) &comp_desc;           /* See the code for comp_desc. */
    );
    rc |= slapi_compute_add_evaluator(compute_attrs);
    return rc;
}

Here, compute_attrs() is the function that computes the attribute value.