Use the LDAP_RESULT API to wait for the result of an asynchronous LDAP operation, obtain LDAP message types, or obtain the message ID of an LDAP message.
#include sys/time.h /* for struct timeval definition */
#include ldap.h
int ldap_result(
LDAP *ld,
int msgid,
int all,
struct timeval *timeout,
LDAPMessage **result)
int ldap_msgtype(
LDAPMessage *msg)
int ldap_msgid(
LDAPMessage *msg)
#define LDAP_RES_BIND 0x61L
#define LDAP_RES_SEARCH_ENTRY 0x64L
#define LDAP_RES_SEARCH_RESULT 0x65L
#define LDAP_RES_MODIFY 0x67L
#define LDAP_RES_ADD 0x69L
#define LDAP_RES_DELETE 0x6bL
#define LDAP_RES_MODRDN 0x6dL
#define LDAP_RES_COMPARE 0x6fL
#define LDAP_RES_SEARCH_REFERENCE 0X73L
#define LDAP_RES_EXTENDED 0X78L
#define LDAP_RES_ANY (-1L)
#define LDAP_RES_RENAME LDAP_RES_MODRDN
The ldap_result() routine is used to wait for and return the result of an operation that is previously initiated by one of the LDAP asynchronous operation routines. For example, ldap_search(), ldap_modify(), and others. These routines return a msgid that uniquely identifies the request. The msgid can then be used to request the result of a specific operation from ldap_result().
The ldap_msgtype() API returns the type of LDAP message, which is based on the LDAP message that is passed as input by using the msg parameter.
The ldap_msgid() API returns the message ID associated with the LDAP message passed as input by using the msg parameter.
ldap_result() returns 0 if the timeout expires, and -1 if an error occurs. The ldap_get_errno() routine can be used to get an error code.
This routine allocates memory for results that it receives. The memory can be deallocated by calling ldap_msgfree().