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_ext(3), ldap_modify_ext(3), etc.).
27       Those routines all return -1 in case of error, and an invocation  iden‐
28       tifier  upon  successful  initiation  of  the operation. The invocation
29       identifier is picked by the library and  is  guaranteed  to  be  unique
30       across  the  LDAP  session.   It can be used to request the result of a
31       specific operation 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  LDAP_OPT_TIMEOUT  value  set  by
37       ldap_set_option(3) is used.  With  the  default  setting,  the   select
38       blocks   indefinitely.    To  effect   a   poll,  the  timeout argument
39       should be a non-NULL pointer, pointing to a zero-valued timeval  struc‐
40       ture.   To  obtain  the  behavior of the default setting, bypassing any
41       value set by ldap_set_option(3), set to -1  the  tv_sec  field  of  the
42       timeout parameter.  See select(2) for further details.
43
44       If  the result of a specific operation is required, msgid should be set
45       to the invocation identifier returned when the operation was initiated,
46       otherwise  LDAP_RES_ANY  or  LDAP_RES_UNSOLICITED should be supplied to
47       wait for any or unsolicited response.
48
49       The all parameter, if non-zero, causes ldap_result() to return all  re‐
50       sponses with msgid, otherwise only the next response is returned.  This
51       is commonly used to obtain all the responses of a search operation.
52
53       A search response is made up of zero or more search  entries,  zero  or
54       more  search  references,  and  zero or more extended partial responses
55       followed by a search result.  If all is set to 0, search  entries  will
56       be  returned  one  at  a  time  as  they come in, via separate calls to
57       ldap_result().  If it's set to 1, the search response will only be  re‐
58       turned  in  its  entirety, i.e., after all entries, all references, all
59       extended partial responses, and the final search result have  been  re‐
60       ceived.
61

RETURN VALUE

63       Upon  success,  the type of the result received is returned and the re‐
64       sult parameter will contain the result of the operation; otherwise, the
65       result  parameter  is  undefined.   This result should be passed to the
66       LDAP parsing routines, ldap_first_message(3) and friends, for interpre‐
67       tation.
68
69       The possible result types returned are:
70
71            LDAP_RES_BIND (0x61)
72            LDAP_RES_SEARCH_ENTRY (0x64)
73            LDAP_RES_SEARCH_REFERENCE (0x73)
74            LDAP_RES_SEARCH_RESULT (0x65)
75            LDAP_RES_MODIFY (0x67)
76            LDAP_RES_ADD (0x69)
77            LDAP_RES_DELETE (0x6b)
78            LDAP_RES_MODDN (0x6d)
79            LDAP_RES_COMPARE (0x6f)
80            LDAP_RES_EXTENDED (0x78)
81            LDAP_RES_INTERMEDIATE (0x79)
82
83       The ldap_msgfree() routine is used to free the memory allocated for re‐
84       sult(s) by ldap_result() or ldap_search_ext_s(3) and friends.  It takes
85       a  pointer  to  the  result or result chain to be freed and returns the
86       type of the last message in the chain.  If the parameter is  NULL,  the
87       function does nothing and returns zero.
88
89       The ldap_msgtype() routine returns the type of a message.
90
91       The ldap_msgid() routine returns the message id of a message.
92

ERRORS

94       ldap_result()  returns  -1  if  something  bad happens, and zero if the
95       timeout specified was exceeded.  ldap_msgtype() and ldap_msgid() return
96       -1 on error.
97

SEE ALSO

99       ldap(3), ldap_first_message(3), select(2)
100

ACKNOWLEDGEMENTS

102       OpenLDAP  Software  is developed and maintained by The OpenLDAP Project
103       <http://www.openldap.org/>.  OpenLDAP Software is derived from the Uni‐
104       versity of Michigan LDAP 3.3 Release.
105
106
107
108OpenLDAP 2.6.2                    2022/05/04                    LDAP_RESULT(3)
Impressum