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