14.3. LDAPControl

Represents a client or server control associated with an LDAP operation.
The LDAPControl data type represents a client or server control associated with an LDAP operation. Controls are part of the LDAPv3 protocol. You can use a client or server control to extend the functionality of an LDAP control.
For example, a server control can specify that the server must sort search results in an LDAP search operation.
Table 14.2, “Frontend API Functions for LDAP Controls” summarizes the frontend API functions that can be called to work with LDAP controls.

Table 14.2. Frontend API Functions for LDAP Controls

To perform this action... Call this function
Append a control to the end of an array or to a new array. slapi_add_control_ext()
Append an array of controls to the end of an array or to a new array. slapi_add_controls()
Create an LDAPControl structure based on a BerElement, an OID, and a criticality flag. It returns an LDAP error code.
slapi_build_control()
Create an LDAPControl structure based on a struct berval, an OID, and a criticality flag. It returns an LDAP error code.
slapi_build_control_from_berval()
Check for the presence of a specific LDAPControl. It returns non-zero for presence and zero for absence.
slapi_control_present()
Retrieve the LDAPMod contained in a Slapi_Mod structure. slapi_mod_get_ldapmod_passout()
Register the specified control with the server. This function associates the control with an object identification (OID). slapi_register_supported_control()
Retrieve an allocated array of object identifiers (OIDs) representing the controls supported by the Directory Server. slapi_get_supported_controls_copy()
Syntax

This struct definition uses the following syntax:

typedef struct ldapcontrol {
 char *ldctl_oid;
 struct berval ldctl_value;
 char ldctl_iscritical;
} LDAPControl;
Parameters

This function has the following parameters:

Table 14.3. LDAPControl Parameters

Field Description
ldctl_oid Object ID (OID) of the control.
ldctl_value berval structure containing the value used by the control for the operation.
ldctl_iscritical Specifies whether the control is critical to the operation. This field can have one of the following values:
  • LDAP_OPT_ON specifies that the control is critical to the operation.
  • LDAP_OPT_OFF specifies that the control is not critical to the operation.