![Netscape NETSCAPE DIRECTORY SERVER 6.2 - GATEWAY CUSTOMIZATION Manual Download Page 35](http://html1.mh-extra.com/html/netscape/netscape-directory-server-6-2-gateway-customization/netscape-directory-server-6-2-gateway-customization_manual_1674642035.webp)
Writing Plug-in Initialization Functions
Chapter
2
Writing and Compiling Plug-Ins
35
For example, if you want to register
searchdn_preop_search()
as a pre-operation
search function, include the following code in your initialization function:
slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_SEARCH_FN, \
(void *) searchdn_preop_search )
SLAPI_PLUGIN_PRE_SEARCH_FN
is the parameter that specifies the pre-operation
plug-in function for the LDAP search operation.
You can register more than one plug-in function in your initialization function; you
do not need to write an initialization function for each plug-in function that you
need to register. You should, however, define a different initialization function for
each type of plug-in that you are registering.
Returning a Value to the Directory Server
If the initialization function is successful, it should return
0
. If an error occurs, it
should return
-1
. If the initialization function returns
-1
, the Directory Server will
exit.
Example of an Initialization Function
The following is an example of an initialization function that registers the
pre-operation plug-in function
searchdn_preop_search()
. After the initialization
function returns, the server will call
searchdn_preop_search()
before each LDAP
search operation is executed.
NOTE
If you do not register your plug-in functions, the Directory Server
will not call your plug-in functions. Make sure to register your
plug-in functions.
Code Example 2-4
An Example Initialization Function
#include "slapi-plugin.h"
...
#ifdef _WIN32
__declspec(dllexport)
#endif
searchdn_preop_init( Slapi_PBlock *pb )
{
/* Specify the version of the plug-in (set this to "01")*/
Summary of Contents for NETSCAPE DIRECTORY SERVER 6.2 - GATEWAY CUSTOMIZATION
Page 1: ...Plug In Programmer s Guide Netscape Directory Server Version6 2 December 2003...
Page 18: ...18 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 56: ...56 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 112: ...112 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 168: ...Plug In API Reference 168 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 170: ...170 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 600: ...600 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 612: ...612 Netscape Directory Server Plug In Programmer s Guide December 2003...