Complete Contents
Getting Started
Chapter 1 Understanding Server Plug-Ins
Chapter 2 Writing and Compiling Plug-Ins
Chapter 3 Calling the Front-End API Functions
Chapter 4 Quick Start
Chapter 5 Writing Database Plug-Ins
Chapter 6 Writing Pre/Post-Operation Plug-Ins
Chapter 7 Defining Functions for LDAP Operations
Chapter 8 Defining Functions for Database Operations
Chapter 9 Defining Functions for Authentication
Chapter 10 Writing Entry Store/Fetch Plug-Ins
Chapter 11 Writing Extended Operation Plug-Ins
Chapter 12 Writing Matching Rule Plug-Ins
Chapter 13 Data Type and Structure Reference
Chapter 14 Function Reference
Chapter 15 Parameter Reference
Glossary
Previous Next Contents Bookshelf


Chapter 10 Writing Entry Store/Fetch Plug-Ins

This chapter describes how to write entry store and entry fetch plug-ins. You can use these types of plug-ins to invoke functions before and after data is read from the default database.

Note. Entry store and entry fetch plug-ins work only with the default database. If you are using your own database and have your own database plug-in, entry store and entry fetch plug-ins will not work.


How Entry Store/Fetch Plug-Ins Work
Entry store plug-in functions are called before data is written to the default database. Entry fetch plug-in functions are called after data is read from the default database.

Figure 10.1 illustrates how the Directory Server back-end calls entry store and entry fetch functions before writing and reading data from the database.

Figure 10.1 How the server calls entry store and entry fetch plug-in functions


Writing Entry Store/Fetch Functions
Unlike most other types of plug-in functions, entry store and entry fetch plug-in functions are not passed a parameter block when called.

Instead, entry store and entry fetch plug-in functions must have the following prototype:

void function_name( char **entry, unsigned long *len );

On Windows NT, use the following prototype and make sure to include the function in a .def file:

__declspec( dllexport ) void function_name( char **entry, unsigned long *len );

The parameters are described below:
entry

Pointer to a string specifying the entry in LDIF format (for details on this format, see "slapi_entry2str()" on page  268).
len

Pointer to the length of the entry string.

Since the text of the entry is passed in as an argument, you can modify the entry before it gets saved to disk and modify the entry after it is read from disk.


Registering Entry Store/Fetch Functions
Unlike most other types of plug-in functions, you do not register an entry store or entry fetch plug-in function by setting the function name in the parameter block.

Instead, you specify the function name directly in the slapd.conf configuration file. Add a directive in the following form to specify the name and location of your plug-in function:

plugin entrystore <library_name> <function_name>

plugin entryfetch <library_name> <function_name>

<library_name> is the name and path to your shared library or dynamic link library, and <function_name> is the name of your plug-in function.

For example, the following directives register the function named my_store() as the entry store plug-in function and my_fetch() as the entry fetch plug-in function. Both functions are defined in the library /usr/nslib/myentry.so.

plugin entrystore /usr/nslib/myentry.so my_store

plugin entryfetch /usr/nslib/myentry.so my_fetch

Note. Each entry store and entry fetch plug-in is associated with the default ldbm back-end. Make sure that the plugin directive that registers the plug-in is within the database section for ldbm in the slapd.conf file. (The plugin directive should be after the database ldbm directive and before the next database directive, if any.)

 

© Copyright 1998 Netscape Communications Corporation