]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_result.3
Happy New Year
[openldap] / doc / man / man3 / ldap_result.3
1 .TH LDAP_RESULT 3 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2018 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldap_result \- Wait for the result of an LDAP operation
7 .SH LIBRARY
8 OpenLDAP LDAP (libldap, \-lldap)
9 .SH SYNOPSIS
10 .nf
11 .ft B
12 #include <ldap.h>
13 .LP
14 .ft B
15 int ldap_result( LDAP *ld, int msgid, int all,
16         struct timeval *timeout, LDAPMessage **result );
17
18 int ldap_msgfree( LDAPMessage *msg );
19
20 int ldap_msgtype( LDAPMessage *msg );
21
22 int ldap_msgid( LDAPMessage *msg );
23 .ft
24 .SH DESCRIPTION
25 The
26 .B ldap_result()
27 routine is used to wait for and return the result of
28 an operation previously initiated by one of the LDAP asynchronous
29 operation routines (e.g.,
30 .BR ldap_search_ext (3),
31 .BR ldap_modify_ext (3),
32 etc.).  Those routines all return \-1 in case of error, and an
33 invocation identifier upon successful initiation of the operation. The
34 invocation identifier is picked by the library and is guaranteed to be
35 unique across the LDAP session.  It can be used to request the result
36 of a specific operation from
37 .B ldap_result()
38 through the \fImsgid\fP parameter.
39 .LP
40 The
41 .B ldap_result()
42 routine will block or not, depending upon the setting
43 of the \fItimeout\fP parameter.
44 If timeout is not a NULL pointer,  it  specifies  a  maximum
45 interval  to wait for the selection to complete.  If timeout
46 is a NULL  pointer, the LDAP_OPT_TIMEOUT value set by
47 .BR ldap_set_option (3)
48 is used. With the default setting,
49 the  select  blocks  indefinitely.   To
50 effect  a  poll,  the  timeout argument should be a non-NULL
51 pointer, pointing to a zero-valued timeval structure.
52 To obtain the behavior of the default setting, bypassing any value set by 
53 .BR ldap_set_option (3),
54 set to -1 the \fItv_sec\fP field of the \fItimeout\fP parameter.
55 See
56 .BR select (2)
57 for further details.
58 .LP
59 If the result of a specific operation is required, \fImsgid\fP should
60 be set to the invocation identifier returned when the operation was
61 initiated, otherwise LDAP_RES_ANY or LDAP_RES_UNSOLICITED should be
62 supplied to wait for any or unsolicited response.
63 .LP
64 The \fIall\fP parameter, if non-zero, causes
65 .B ldap_result()
66 to return all responses with msgid, otherwise only the
67 next response is returned.  This is commonly used to obtain all
68 the responses of a search operation.
69 .LP
70 A search response is made up of zero or
71 more search entries, zero or more search references, and zero or
72 more extended partial responses followed by a search result.  If
73 \fIall\fP is set to 0, search entries will be returned one at a
74 time as they come in, via separate calls to
75 .BR ldap_result() .
76 If it's set to 1, the search
77 response will only be returned in its entirety, i.e., after all entries,
78 all references, all extended partial responses, and the final search
79 result have been received.
80 .SH RETURN VALUE
81 Upon success, the type of the result received is returned and the
82 \fIresult\fP parameter will contain the result of the operation;
83 otherwise, the \fIresult\fP parameter is undefined.  This
84 result should be passed to the LDAP parsing routines,
85 .BR ldap_first_message (3)
86 and friends, for interpretation.
87 .LP
88 The possible result types returned are:
89 .LP
90 .nf
91         LDAP_RES_BIND (0x61)
92         LDAP_RES_SEARCH_ENTRY (0x64)
93         LDAP_RES_SEARCH_REFERENCE (0x73)
94         LDAP_RES_SEARCH_RESULT (0x65)
95         LDAP_RES_MODIFY (0x67)
96         LDAP_RES_ADD (0x69)
97         LDAP_RES_DELETE (0x6b)
98         LDAP_RES_MODDN (0x6d)
99         LDAP_RES_COMPARE (0x6f)
100         LDAP_RES_EXTENDED (0x78)
101         LDAP_RES_INTERMEDIATE (0x79)
102 .fi
103 .LP
104 The
105 .B ldap_msgfree()
106 routine is used to free the memory allocated for
107 result(s) by
108 .B ldap_result()
109 or
110 .BR ldap_search_ext_s (3)
111 and friends.
112 It takes a pointer to the result or result chain to be freed and returns
113 the type of the last message in the chain.
114 If the parameter is NULL, the function does nothing and returns zero.
115 .LP
116 The
117 .B ldap_msgtype()
118 routine returns the type of a message.
119 .LP
120 The
121 .B ldap_msgid()
122 routine returns the message id of a message.
123 .SH ERRORS
124 .B ldap_result()
125 returns \-1 if something bad happens, and zero if the
126 timeout specified was exceeded.
127 .B ldap_msgtype()
128 and
129 .B ldap_msgid()
130 return \-1 on error.
131 .SH SEE ALSO
132 .BR ldap (3),
133 .BR ldap_first_message (3),
134 .BR select (2)
135 .SH ACKNOWLEDGEMENTS
136 .so ../Project