Up to Contents

Back to Deleting an Entry

Extended Operations

The ldap_extended_operation() and ldap_extended_operation_s() routines allow extended LDAP operations to be passed to the server, providing a general protocol extensibility mechanism.

           int ldap_extended_operation(
                   LDAP            *ld,
                   char            *exoid,
                   struct berval   *exdata,
                   LDAPControl     **serverctrls,
                   LDAPControl     **clientctrls,
                   int             *msgidp
           );

           int ldap_extended_operation_s(
                   LDAP            *ld,
                   char            *exoid,
                   struct berval   *exdata,
                   LDAPControl     **serverctrls,
                   LDAPControl     **clientctrls,
                   char            **retoidp,
                   struct berval   **retdatap
           );

Parameters are:

ld
The session handle.
requestoid
The dotted-OID text string naming the request.
requestdata
The arbitrary data required by the operation (if NULL, no data is sent to the server).
serverctrls
List of LDAP server controls.
clientctrls
List of client controls.
msgidp
This result parameter will be set to the message id of the request if the ldap_extended_operation() call succeeds.
retoidp
Pointer to a character string that will be set to an allocated, dotted-OID text string returned by the server. This string should be disposed of using the ldap_memfree() function. If no OID was returned, *retoidp is set to NULL.
retdatap
Pointer to a berval structure pointer that will be set an allocated copy of the data returned by the server. This struct berval should be disposed of using ber_bvfree(). If no data is returned, *retdatap is set to NULL.

The ldap_extended_operation() function initiates an asynchronous extended operation and returns the constant LDAP_SUCCESS if the request was successfully sent, or another LDAP error code if not. See the section below on error handling for more information about possible errors and how to interpret them. If successful, ldap_extended_operation() places the message id of the request in *msgidp. A subsequent call to ldap_result(), described below, can be used to obtain the result of the extended operation which can be passed to ldap_parse_extended_result() to obtain the OID and data contained in the response.

The synchronous ldap_extended_operation_s() function returns the result of the operation, either the constant LDAP_SUCCESS if the operation was successful, or another LDAP error code if it was not. See the section below on error handling for more information about possible errors and how to interpret them. The retoid and retdata parameters are filled in with the OID and data from the response. If no OID or data was returned, these parameters are set to NULL.

The ldap_extended_operation() and ldap_extended_operation_s() functions both support LDAPv3 server controls and client controls.

Up to Contents

Forward to Abandoning an Operation