Sun Java System Directory Server Enterprise Edition 6.2 Developer's Guide

Creating New Entries

Create a completely new entry by using slapi_entry_alloc() to allocate the memory that is required, as shown in the following example.


Example 5–1 Creating a New Entry (entries.c)

#include "slapi-plugin.h"

int
test_ldif()
{
    Slapi_Entry * entry = NULL;        /* Entry to hold LDIF      */

    /* Allocate the Slapi_Entry structure.                        */
    entry = slapi_entry_alloc();

    /* Add code that fills the Slapi_Entry structure.             */

    /* Add code that uses the Slapi_Entry structure.              */

    /* Release memory allocated for the entry.                    */
    slapi_entry_free(entry);

    return (0);
}