HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
48 Functions for registering object extensions
This chapter contains reference information on routines for registering object extensions. This
set of functions provides a means for extending core server objects; this functionality is provided
so that you can efficiently pass state information between plug-in calls. Typically, a plug-in might
register both a preoperation and postoperation call. It is very convenient for the plug-in to
associate its private data with the operation object that is passed through the parameter block.
Table 48-1 Routines for registering object extensions
DescriptionFunction
Retrieves a pointer to the plug-in extension.“slapi_get_object_extension()”
Registers a plug-in's object extension.“slapi_register_object_extension()”
Changes a plug-in's object extension.“slapi_set_object_extension()”
48.1 slapi_get_object_extension()
Description A plug-in retrieves a pointer to its own extension by calling
slapi_get_object_extension with the object from which the extension is to be retrieved.
The factory uses objecttype to find the offset into the object where the extension block is
stored. The extension handle is then used to find the appropriate extension within the block.
Syntax
#include "slapi-plugin.h"
void *slapi_get_object_extension(int objecttype,
void *object, int extensionhandle);
Parameters This function takes the following parameters:
The object type handle that was returned from the “slapi_register_object_extension()”
call.
objecttype
A pointer to the core server object from which the extension is to be retrieved.
object
The extension handle that was returned from the “slapi_register_object_extension()”
call.
extensionhandle
Returns This function returns a pointer to the plug-in's extension.
See also
“slapi_register_object_extension()”
“slapi_set_object_extension()”
48.2 slapi_register_object_extension()
Description When a plug-in is initialized, it must register its object extensions. It must provide
the name of the object to be extended, e.g., Operation, and constructor and destructor functions.
These functions are called when the object is constructed and destroyed. The extension functions
must allocate some memory and initialize it for its own use. The registration function will fail if
any objects have already been created; this is why the registration must happen during plug-in
initialization. In return, the plug-in will receive two handles, one for the object type and another
one for the object extension; these only have meaning for the “slapi_get_object_extension()”
function.
Syntax
#include "slapi-plugin.h"
int slapi_register_object_extension( const char *pluginname,
48.1 slapi_get_object_extension() 369