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
50       responses  with  msgid,  otherwise  only the next response is returned.
51       This is commonly used to obtain all the responses of  a  search  opera‐
52       tion.
53
54       A  search  response  is made up of zero or more search entries, zero or
55       more search references, and zero or  more  extended  partial  responses
56       followed  by  a search result.  If all is set to 0, search entries will
57       be returned one at a time as  they  come  in,  via  separate  calls  to
58       ldap_result().   If  it's  set  to  1, the search response will only be
59       returned in its entirety, i.e., after all entries, all references,  all
60       extended  partial  responses,  and  the  final  search result have been
61       received.
62

RETURN VALUE

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

ERRORS

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

SEE ALSO

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

ACKNOWLEDGEMENTS

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