Sun Directory Server Enterprise Edition 7.0 Developer's Guide

Registering Entry Store and Entry Fetch Plug-Ins

The following example demonstrates how entry store and entry fetch plug-ins are registered with Directory Server.


Example 8–3 Registering Entry Store and Entry Fetch Plug-Ins (testentry.c)

#include "slapi-plugin.h"

Slapi_PluginDesc entrypdesc = {
  "test-entry",                      /* plug-in identifier      */
  "Sun Microsystems, Inc.",          /* vendor name             */
  "7.0",                             /* plug-in revision number */
  "Sample entry store/fetch plug-in" /* plug-in description     */
};

int
testentry_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 *) &entrypdesc    );
  rc |= slapi_pblock_set(            /* Entry store function    */
      pb,
      SLAPI_PLUGIN_ENTRY_STORE_FUNC,  
      (void *) testentry_scramble
  );
  rc |= slapi_pblock_set(            /* Entry fetch function    */
      pb,
      SLAPI_PLUGIN_ENTRY_FETCH_FUNC,  
      (void *) testentry_unscramble
  );
  return rc;
}