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