ldap_create_persistentsearch_control

Creates and encodes a persistent search control.

LDAP Version:v3
Library:*ldapsdk.*
NDS Version:8.5 or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap.h>
  
  int ldap_create_persistentsearch_control (
     LDAP            *ld,
     int             changeTypes,
     int             changesOnly,
     int             returnEchgCtls,
     char            isCritical,
     LDAPControl   **ctrlp);
  
  

Parameters

ld

(IN) Points to the handle of the LDAP session.

changeTypes

(IN) an integer whose value is the bit-wise OR of the flag values corresponding to the changes types for which a the client wishes to be notified. Valid flags are as follows:

LDAP_CHANGETYPE_ADD

specifies that you want to be notified when entries are added to the directory

LDAP_CHANGETYPE_DELETE

specifies that you want to be notified when entries are deleted from the directory

LDAP_CHANGETYPE_MODIFY

specifies that you want to be notified when entries are modified.

LDAP_CHANGETYPE_MODDN

specifies that you want to be notified when entries are renamed.

LDAP_CHANGETYPE_ANY

specifies that you want to be notified when any of the above changes are made.

changesOnly

(IN) If non-zero, the initial search is only used to establish a result set on the server. No results are returned from this initial search. As changes are subsequently made to entries in the result set, the server returns the changed entries to the client. If zero, both the results of the initial search and entries that are subsequently changed are returned.

returnEntryChangeCtrl

(IN) If non-zero, an entry change notification control is included with each entry. If 0, entry change notification controls are not included with the entries returned from the server.

isCritical

(IN) Specifies whether or not the persistent search control is critical to the search operation. If non-zero, the control is critical to the search operation. If the server does not support persistent searches, the server will return the error LDAP_UNAVAILABLE_CRITICAL_EXTENSION.

If 0, the control is not critical to the search operation. Even if the server does not support persistent searches, the search operation is still performed.]

ctrlp

(OUT) Points to a pointer for the LDAPControl structure which this function creates and which can be used in the search operation. When you are done with this control, its memory should be freed by calling the ldap_control_free function.

Return Values

0x00

LDAP_SUCCESS

0x53

LDAP_ENCODING_ERROR

0x59

LDAP_PARAM_ERROR

0x5A

LDAP_NO_MEMORY

Non-zero

Non-zero values indicate errors. See LDAP Return Codes.

Remarks

This API creates an LDAP persistent search control using the supplied parameters. The control can then be used in a call to ldap_search_ext to request that the server perform a persistent search. A persistent search allows the client to be notified when changes are made to entries that satisfy the specified search filter. When a persistent search is performed, the connection to the server remains open until the cient abandons the search or unbinds from the server. The timeout parameters to the search are ignored.

For example code, see searchPersist.c.

See Also

ldap_search_ext, ldap_parse_entrychange_control