ldap_result

Obtains results from a previous asynchronously initiated operation.

LDAP Version:v2 or higher
Library:*ldapsdk.*
NDS Version:7.xx 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_result (
     LDAP             *ld,
     int               msgid,
     int               all,
     struct timeval   *timeout,
     LDAPMessage     **res);
  
  

Parameters

ld

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

msgid

(IN) Specifies the message ID returned in the LDAP operation's msgidp parameter. Accepts the following special flags:

  • LDAP_RES_UNSOLICITED (0) indicates that an unsolicited result is requested.

  • LDAP_RES_ANY (-1) indicates that any result is to be returned.

all

(IN) Specifies how many messages are retrieved in a single call to the ldap_result function. Uses one of the following flags:

  • LDAP_MSG_ONE (0x00) indicates that messages are retrieved one at a time.

  • LDAP_MSG_ALL (0x01) indicates that all results of the search must be received before returning with all the messages in a single chain.

  • LDAP_MSG_RECEIVED (0x02) indicates that all messages received so far must be returned in a result chain.

timeout

(IN) Points to a timeval structure that specifies how long to wait for the results to be returned.

  • To block until the results are available, pass a NULL value.

  • To cause continuous polling, set the tv_sec field in the timeval structure to zero seconds.

res

(OUT) Points to the results of the search. If no results are returned, this parameter is set to NULL.

Return Values

0x00

Timeout expired

-1

Failure

Remarks

Only asynchronous search operations can contain more than one message.

Upon successful completion, the ldap_result function returns the type of message. For a list of possible types, see Section 6.9, Result Message Types.

If the ldap_result function returns a -1, use the ldap_get_option function with the option parameter set to LDAP_OPT_RESULT_CODE to retrieve the error code from the LDAP session handle.

The ldap_result function allocates memory for the res parameter. When you are done with it, free the memory by calling the ldap_msgfree function.

See Also

ldap_msgfree, ldap_msgid, ldap_msgtype