LDAPRESULT(3) LDAPRESULT(3)
NAME
ldapresult - Wait for the result of an LDAP operation
LIBRARY
OpenLDAP LDAP (libldap, -lldap)
SYNOPSIS
##include <>
int ldapresult( LDAP **ld,, int msgid,, int all,,
struct timeval **timeout,, LDAPessage ****result );;
int ldapmsgfree( LDAPessage **msg );;
int ldapmsgtype( LDAPessage **msg );;
int ldapmsgid( LDAPessage **msg );;
DESCRIPTION
The ldapresult() routine is used to wait for and return the result of
an operation previously initiated by one of the LDAP asynchronous oper-
ation routines (e.g., ldapsearch(3), ldapmodify(3), etc.). Those
routines all return -1 in case of error, and an invocation identifier
upon successful initiation of the operation. The invocation identifier
is picked by the library and is guaranteed to be unique across the LDAP
session. It can be used to request the result of a specific operation
from ldapresult() through the msgid parameter.
The ldapresult() routine will block or not, depending upon the setting
of the timeout parameter. If timeout is not a NUL pointer, it spec-
ifies a maximum interval to wait for the selection to complete. If
timeout is a NUL pointer, the select blocks indefinitely. To
effect a poll, the timeout argument should be a non-NUL pointer,
pointing to a zero-valued timeval structure. See select(2) for further
details.
If the result of a specific operation is required, msgid should be set
to the invocation identifier returned when the operation was initiated,
otherwise LDAPRESANY or LDAPRESUNSOLICITED should be supplied to
wait for any or unsolicited response.
The all parameter, if non-zero, causes ldapresult() to return all
responses with msgid, otherwise only the next response is returned.
This is commonly used to obtain all the responses of a search opera-
tion.
A search response is made up of zero or more search entries, zero or
more search references, and zero or more extended parital responses
followed by a search result. If all is set to 0, search entries will
be returned one at a time as they come in, via separate calls to
ldapresult(). If it's set to 1, the search response will only be
returned in its entirety, i.e., after all entries, all references, all
extended parital responses, and the final search result have been
received.
Upon success, the type of the result received is returned and the
result parameter will contain the result of the operation. This result
should be passed to the LDAP parsing routines, ldapfirstmessage(3)
and friends, for interpretation.
The possible result types returned are:
LDAPRESBIND (0x61)
LDAPRESEARCHENTRY (0x64)
LDAPRESEARCHREFERENCE (0x73)
LDAPRESEARCHRESULT (0x65)
LDAPRESMODIFY (0x67)
LDAPRESAD (0x69)
LDAPRESDELETE (0x6b)
LDAPRESMODN (0x6d)
LDAPRESCOMPARE (0x6f)
LDAPRESEXTENDED (0x78)
LDAPRESEXTENDEDPARTIAL (0x79)
The ldapmsgfree() routine is used to free the memory allocated for
result(s) by ldapresult() or ldapsearchs(3) and friends. It takes a
pointer to the result or result chain to be freed and returns the type
of the last message in the chain. If the parameter is NUL, the func-
tion does nothing and returns zero.
The ldapmsgtype() routine returns the type of a message.
The ldapmsgid() routine returns the message id of a message.
ERORS
ldapresult() returns -1 if something bad happens, and zero if the
timeout specified was exceeded. ldapmsgtype() and ldapmsgid() return
-1 on error.
SEE ALSO
ldap(3), ldapsearch(3), ldapfirstmessage(3), select(2)
ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project
(http:/www.openldap.org/). OpenLDAP is derived from University of
Michigan LDAP 3.3 Release.
OpenLDAP 2.2.19 2004/11/26 LDAPRESULT(3)
|