LDAP_CREATE_PERSISTENTSEARCH_CONTROL

Use the LDAP_CREATE_PERSISTENTSEARCH_CONTROL API or LDAP routine to create a persistent search control that can be passed to the ldap_search_ext() or ldap_search_ext_s() function to initiate a persistent search.

Synopsis

#include ldap.h


#define LDAP_CHANGETYPE_ADD      1
#define LDAP_CHANGETYPE_DELETE   2
#define LDAP_CHANGETYPE_MODIFY   4
#define LDAP_CHANGETYPE_MODDN    8
#define LDAP_CHANGETYPE_ANY      (1|2|4|8)

#define LDAP_CONTROL_PERSISTENTSEARCH   "2.16.840.1.113730.3.4.3"

int ldap_create_peristentsearch_control(
         LDAP       *ld,
         int        changetypes,
         int        changesonly,
         int        return_echg_ctls,
         char       ctl_iscritical,
         LDAPControl **ctrlp);

Input parameters

ld
Specifies the LDAP pointer, which acts as an LDAP session handle, returned by previous call to ldap_init(), ldap_ssl_init(), or ldap_open().
changetypes
Specifies a bit field that indicates the client about the type of changes. The value of the field can be LDAP_CHANGETYPE_ANY or any logical-OR combination of one or more of the following values:
  • LDAP_CHANGETYPE_ADD
  • LDAP_CHANGETYPE_DELETE
  • LDAP_CHANGETYPE_MODIFY
  • LDAP_CHANGETYPE_MODDN
The changetypes field corresponds to the changeType element of the BER-encoded persistent search control value.
changesonly

It is a boolean field that specifies whether the searchResultEntry messages for entries that are changed or all the static entries that match the search criteria must be returned to the client.

If the value is non-zero, the entries that are changed are returned. If zero, all the static entries that match search criteria are returned before the server sends change notification. The changesonly field corresponds to the changesOnly element of the BER-encoded persistent search control value.

return_echg_ctls
It is a boolean field that specifies the behavior of the server about the returning of an Entry Change Notification control with each searchResultEntry when an entry is changed. If the value of this field is non-zero, the Entry Change Notification controls are requested. If zero, the Entry Change Notification controls are not requested. The return_echg_ctls field corresponds to the returnECs element of the BER-encoded persistent search control value.
ctl_iscritical
Sets the ctl_iscritical flag within the resulting LDAPControl structure. A non-zero value indicates that the persistent search control is critical and a zero value indicates that this control is not critical.

Output parameters

ctrlp
This result parameter is assigned the address of an LDAPControl structure that contains the Persistent Search control that is created by this routine.
Note: The caller must free the memory that is occupied by the LDAPControl structure after its use by calling ldap_control_free().

Usage

This routine is used to create a persistent search control that can be passed to the ldap_search_ext() or ldap_search_ext_s() function to initiate a persistent search. If the operation is successful, LDAP_SUCCESS is returned.

Errors

This routine returns an LDAP error code if the operation is a failure.

See LDAP_ERROR for a list of the LDAP error codes.