1LDAP_RESULT(3)             Library Functions Manual             LDAP_RESULT(3)
2
3
4

NAME

6       ldap_result - Wait for the result of an LDAP operation
7

LIBRARY

9       OpenLDAP LDAP (libldap, -lldap)
10

SYNOPSIS

12       #include <ldap.h>
13
14       int ldap_result( LDAP *ld, int msgid, int all,
15            struct timeval *timeout, LDAPMessage **result );
16
17       int ldap_msgfree( LDAPMessage *msg );
18
19       int ldap_msgtype( LDAPMessage *msg );
20
21       int ldap_msgid( LDAPMessage *msg );
22

DESCRIPTION

24       The  ldap_result() routine is used to wait for and return the result of
25       an operation previously initiated by one of the LDAP asynchronous oper‐
26       ation  routines  (e.g.,  ldap_search(3),  ldap_modify(3), etc.).  Those
27       routines all return -1 in case of error, and an  invocation  identifier
28       upon  successful initiation of the operation. The invocation identifier
29       is picked by the library and is guaranteed to be unique across the LDAP
30       session.   It can be used to request the result of a specific operation
31       from ldap_result() through the msgid parameter.
32
33       The ldap_result() routine will block or not, depending upon the setting
34       of the timeout parameter.  If timeout is not a NULL pointer,  it  spec‐
35       ifies  a  maximum interval  to wait for the selection to complete.   If
36       timeout  is  a  NULL  pointer,  the  select  blocks  indefinitely.   To
37       effect  a  poll,  the  timeout argument should be a  non-NULL  pointer,
38       pointing to a zero-valued timeval structure.  See select(2) for further
39       details.
40
41       If the result of a specific operation is required, msgid should be  set
42       to the invocation identifier returned when the operation was initiated,
43       otherwise LDAP_RES_ANY or LDAP_RES_UNSOLICITED should  be  supplied  to
44       wait for any or unsolicited response.
45
46       The  all  parameter,  if  non-zero,  causes ldap_result() to return all
47       responses with msgid, otherwise only the  next  response  is  returned.
48       This  is  commonly  used to obtain all the responses of a search opera‐
49       tion.
50
51       A search response is made up of zero or more search  entries,  zero  or
52       more  search  references,  and  zero or more extended partial responses
53       followed by a search result.  If all is set to 0, search  entries  will
54       be  returned  one  at  a  time  as  they come in, via separate calls to
55       ldap_result().  If it's set to 1, the  search  response  will  only  be
56       returned  in its entirety, i.e., after all entries, all references, all
57       extended partial responses, and  the  final  search  result  have  been
58       received.
59
60       Upon  success,  the  type  of  the  result received is returned and the
61       result parameter will contain the result of the operation.  This result
62       should  be  passed  to the LDAP parsing routines, ldap_first_message(3)
63       and friends, for interpretation.
64
65       The possible result types returned are:
66
67            LDAP_RES_BIND (0x61)
68            LDAP_RES_SEARCH_ENTRY (0x64)
69            LDAP_RES_SEARCH_REFERENCE (0x73)
70            LDAP_RES_SEARCH_RESULT (0x65)
71            LDAP_RES_MODIFY (0x67)
72            LDAP_RES_ADD (0x69)
73            LDAP_RES_DELETE (0x6b)
74            LDAP_RES_MODDN (0x6d)
75            LDAP_RES_COMPARE (0x6f)
76            LDAP_RES_EXTENDED (0x78)
77            LDAP_RES_EXTENDED_PARTIAL (0x79)
78
79       The ldap_msgfree() routine is used to free  the  memory  allocated  for
80       result(s) by ldap_result() or ldap_search_s(3) and friends.  It takes a
81       pointer to the result or result chain to be freed and returns the  type
82       of  the last message in the chain.  If the parameter is NULL, the func‐
83       tion does nothing and returns zero.
84
85       The ldap_msgtype() routine returns the type of a message.
86
87       The ldap_msgid() routine returns the message id of a message.
88

ERRORS

90       ldap_result() returns -1 if something bad  happens,  and  zero  if  the
91       timeout specified was exceeded.  ldap_msgtype() and ldap_msgid() return
92       -1 on error.
93

SEE ALSO

95       ldap(3), ldap_search(3), ldap_first_message(3), select(2)
96

ACKNOWLEDGEMENTS

98       OpenLDAP  is  developed  and  maintained  by   The   OpenLDAP   Project
99       (http://www.openldap.org/).   OpenLDAP  is  derived  from University of
100       Michigan LDAP 3.3 Release.
101
102
103
104OpenLDAP 2.3.34                    2007/2/16                    LDAP_RESULT(3)
Impressum