48.2. slapi_register_object_extension()
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.
#include "slapi-plugin.h" int slapi_register_object_extension( const char *pluginname, const char *objectname, slapi_extension_constructor_fnptr constructor, slapi_extension_destructor_fnptr destructor, int *objecttype, int *extensionhandle);
This function takes the following parameters:
|
pluginname
| Plug-in name. |
|
objectname
| The name of the core server object to be extended. Objects that can be extended (possible values for the objectname parameter):
Operation and Connection are supported. |
|
constructor
| The function provided by the plug-in which is to be called when an instance of the core server object is created. This function must allocate some memory and return a pointer to be stored in the extension block on the object. |
|
destructor
| The function which is called when an instance of an object is destroyed. This function must release any resources acquired by the constructor function. |
|
objecttype
| Handle to find the offset into the object where the extension block is stored. |
|
extensionhandle
| Address, which is used to find the extension within the block. |
This function returns 0 if successful, error code otherwise.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.