]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_first_message.3
d0845152be8859260e1de5d2b4a63462054eee21
[openldap] / doc / man / man3 / ldap_first_message.3
1 .TH LDAP_FIRST_MESSAGE 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_first_message, ldap_next_message, ldap_count_messages \- Stepping
7 through messages in a result chain
8 .SH LIBRARY
9 OpenlDAP LDAP (libldap, -lldap)
10 .SH SYNOPSIS
11 .nf
12 .ft B
13 #include <ldap.h>
14 .LP
15 .ft B
16 int ldap_count_messages( LDAP *ld, LDAPMessage *result )
17 .LP
18 .ft B
19 LDAPMessage *ldap_first_message( LDAP *ld, LDAPMessage *result )
20 .LP
21 .ft B
22 LDAPMessage *ldap_next_message( LDAP *ld, LDAPMessage *message )
23 .SH DESCRIPTION
24 .LP
25 These routines are used to step through the messages in a result chain
26 received from
27 .BR ldap_result (3) .
28 For search operations, the result chain can contain referral, entry
29 and result messages. The
30 .BR ldap_msgtype (3)
31 function can be used to distinguish between the different message types.
32 .LP
33 The
34 .B ldap_first_message()
35 routine is used to retrieve the first message in a result chain.
36 It takes the \fIresult\fP as returned by a call to
37 .BR ldap_result (3) ,
38 .BR ldap_search_s (3)
39 or
40 .BR ldap_search_st (3)
41 and returns a pointer to the first message in the result chain.
42 .LP
43 This pointer should be supplied on a subsequent call to
44 .B ldap_next_message()
45 to get the next message, the result of which should be
46 supplied to the next call to
47 .BR ldap_next_message() ,
48 etc.
49 .B ldap_next_message()
50 will return NULL when there are no more messages.
51 .LP
52 These functions are useful when using routines like
53 .BR ldap_parse_result (3)
54 that only operate on the first result in the chain.
55 .LP
56 A count of the number of messages in the result chain can be obtained
57 by calling
58 .BR ldap_count_messages() .
59 It can also be used to count the number of remaining messages in a chain
60 if called with a message, entry or reference returned by
61 .B ldap_first_message() ,
62 .B ldap_next_message() ,
63 .BR ldap_first_entry (3) ,
64 .BR ldap_next_entry (3) ,
65 .BR ldap_first_reference (3) ,
66 .BR ldap_next_reference (3) .
67 .SH ERRORS
68 If an error occurs in
69 .B ldap_first_message()
70 or
71 .BR ldap_next_message() ,
72 NULL is returned.  If an error occurs in
73 .BR ldap_count_messages() ,
74 -1 is returned.
75 .SH SEE ALSO
76 .BR ldap (3),
77 .BR ldap_search (3),
78 .BR ldap_result (3),
79 .BR ldap_parse_result (3),
80 .BR ldap_first_entry (3),
81 .BR ldap_first_reference (3)
82 .SH ACKNOWLEDGEMENTS
83 .B      OpenLDAP
84 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
85 .B      OpenLDAP
86 is derived from University of Michigan LDAP 3.3 Release.