HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
21.2 slapi_add_controls()
This function specifies an array of LDAPControls, and either appends the array to the end of a
specified array or uses it to create a new array.
An existing array is grown using slapi_ch_realloc(). Otherwise, a new array is created using
slapi_ch_malloc().
Syntax
#include "slapi-plugin.h"
void slapi_add_controls(LDAPControl ***ctrlsp, LDAPControl
*newctrl, int copy)
Parameters This function takes the following parameters:
Pointer that will receive the specified LDAPControl array. If ctrls is NULL, then a
new array is created using slapi_ch_malloc().
ctrlsp
Pointer to the specified LDAPControl array.newctrl
Sets whether the given control is copied. If the value is true (0), then the control in
newctrl is copied. If the value is false (1), then the control in newctrl is used and
owned by the array and must be freed using ldap_controls_free.
copy
Returns This function returns LDAP_SUCCESS (LDAP result code) if successful.
See also
slapi_ch_realloc()
slapi_ch_malloc()
ldap_controls_free
21.3 slapi_build_control()
This function creates an LDAPControl structure based on a BerElement, an OID, and a criticality
flag. The LDAPControl that is created can be used in LDAP client requests or internal operations.
Syntax
#include "slapi-plugin.h"
int slapi_build_control( char *oid, BerElement *ber,
char iscritical, LDAPControl **ctrlp );
Parameters This function takes the following parameters:
The OID (object identifier) for the control that is to be created.
oid
A BerElement that contains the control value. Pass NULL if the control has no value.ber
The criticality flag. If nonzero, the control will be marked as critical. If 0, it will not be
marked as critical.
iscritical
Pointer that will receive the allocated LDAPControl structure.ctrlp
Returns This function returns LDAP_SUCCESS (LDAP result code) if successful.
Memory concerns The contents of the ber parameter are consumed by this function. Because
of this, the caller should not free the BerElement after a successful call has been made to
slapi_build_control().
The LDAPControl pointer that is returned in ctrlp should be freed by calling
ldap_control_free(), which is an LDAP API function; see the Mozilla LDAP SDK for C
Programmer's Guide.
See also
196 Functions for dealing with controls