Show Table of Contents
9.2. Writing Entry Store/Fetch Functions
Unlike most other types of plug-in functions, a parameter block is not passed to entry store and entry fetch plug-in functions when they are called. Instead, entry store and entry fetch plug-in functions must have the following prototype:
void function_name( char **entry, unsigned long *len );
The function parameters are described below:
- entry — Pointer to a string specifying the entry in LDIF format; for details on this format, see slapi_str2entry() and slapi_entry2str().
- len — Pointer to the length of the entry string.
Because 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. The pointer can be reallocated to get more room. For example:
void my_entry_fetch( char **entry, unsigned long *len )
{
...
*len = newsize;
*entry = slapi_ch_realloc(*entry, (*len) * sizeof(char));
... append to *entry ...
}
The server calls slapi_ch_free() to free the memory, so to allocate more memory, use one of the slapi memory allocation functions.
Note
The
testentry.c sample file has example entry store and entry fetch plug-in functions. This example file is with other examples in the /usr/lib64/dirsrv/plugins directory.

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.