HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
21 Functions for dealing with controls
This chapter contains reference information on routines for dealing with controls.
Table 21-1 Routines for dealing with controls
DescriptionFunction
Adds the specified control to the end of an array of controls.slapi_add_control_ext()
Appends all of an array of controls to an existing array of controls.slapi_add_controls()
Creates an LDAPControl structure based on a BerElement, an OID, and a
criticality flag.
“slapi_build_control()”
Creates an LDAPControl structure based on a struct berval, an OID,
and a criticality flag.
“slapi_build_control_from_berval()”
Determines whether the specified object identification (OID) identifies a
control that is present in a list of controls.
“slapi_control_present()”
Makes an allocated copy of an LDAPControl.
“slapi_dup_control()”
Retrieves an allocated array of object identifiers (OIDs) representing the
controls supported by the Directory Server.
slapi_get_supported_controls_copy()
Registers the specified control with the server. This function associates the
control with an object identification (OID).
“slapi_register_supported_control()”
21.1 slapi_add_control_ext()
This function specifies an LDAPControl, and appends the control to the end of a specified array
or creates a new array. For example:
slapi_add_control_ext(&ctrls, newctrl, 1);
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_control_ext(LDAPControl ***ctrlsp, LDAPControl
*newctrl, int copy)
Parameters This function takes the following parameters:
Pointer that will receive the specified LDAPControl. If ctrls is NULL, then the array
is created using slapi_ch_malloc().
ctrlsp
Pointer to the specified LDAPControl.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.1 slapi_add_control_ext() 195