]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_get_values.3
da4e8ce916bb38f2ac24e9e19db3550ce51c5f57
[openldap] / doc / man / man3 / ldap_get_values.3
1 .TH LDAP_GET_VALUES 3 "22 September 1998" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-1999 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldap_get_values, ldap_get_values_len, ldap_count_values \- LDAP attribute value handling routines
7 .SH SYNOPSIS
8 .nf
9 .ft B
10 #include <ldap.h>
11
12 typedef struct berval {
13     unsigned long bv_len;
14     char *bv_val;
15 };
16 .LP
17 .ft B
18 char **ldap_get_values(ld, entry, attr)
19 .ft
20 LDAP *ld;
21 LDAPMessage *entry;
22 char *attr
23 .LP
24 .ft B
25 struct berval **ldap_get_values_len(ld, entry, attr)
26 .ft
27 LDAP *ld;
28 LDAPMessage *entry;
29 char *attr
30 .LP
31 .ft B
32 ldap_count_values(vals)
33 .ft
34 char **vals;
35 .LP
36 .ft B
37 ldap_count_values_len(vals)
38 .ft
39 struct berval **vals;
40 .LP
41 .ft B
42 ldap_value_free(vals)
43 .ft
44 char **vals;
45 .LP
46 .ft B
47 ldap_value_free_len(vals)
48 .ft
49 struct berval **vals;
50 .SH DESCRIPTION
51 These routines are used to retrieve and manipulate attribute values
52 from an LDAP entry as returned by
53 .BR ldap_first_entry (3)
54 or
55 .BR ldap_next_entry (3).
56 .B ldap_get_values()
57 takes the \fIentry\fP and the attribute \fIattr\fP
58 whose values are desired and returns a NULL-terminated array of the
59 attribute's values.  \fIattr\fP may be an attribute type as returned
60 from
61 .BR ldap_first_attribute (3)
62 or
63 .BR ldap_next_attribute (3),
64 or if the attribute type is known it can simply be given.
65 .LP
66 The number of values in the array can be counted by calling
67 .BR ldap_count_values() .
68 The array of values returned can be freed by calling
69 .BR ldap_value_free() .
70 .LP
71 If the attribute values are binary in nature, and thus not suitable
72 to be returned as an array of char *'s, the
73 .B ldap_get_values_len()
74 routine can be used instead.  It takes the same parameters as
75 .BR ldap_get_values() ,
76 but returns a NULL-terminated array of pointers
77 to berval structures, each containing the length of and a pointer
78 to a value.
79 .LP
80 The number of values in the array can be counted by calling
81 .BR ldap_count_values_len() .
82 The array of values returned can be freed by calling
83 .BR ldap_value_free_len() .
84 .SH ERRORS
85 If an error occurs in
86 .B ldap_get_values()
87 or
88 .BR ldap_get_values_len() ,
89 NULL is returned and the
90 .B ld_errno
91 field in the \fIld\fP parameter is set to
92 indicate the error.  See
93 .BR ldap_error (3)
94 for a description of possible error codes.
95 .SH NOTES
96 These routines dynamically allocate memory which the caller must free
97 using the supplied routines.
98 .SH SEE ALSO
99 .BR ldap(3),
100 .BR ldap_first_entry(3),
101 .BR ldap_first_attribute(3),
102 .BR ldap_error(3)
103 .SH ACKNOWLEDGEMENTS
104 .B      OpenLDAP
105 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
106 .B      OpenLDAP
107 is derived from University of Michigan LDAP 3.3 Release.