xref: /onnv-gate/usr/src/lib/libidmap/common/directory_private.h (revision 10122:96eda55bfd54)
1*10122SJordan.Brown@Sun.COM /*
2*10122SJordan.Brown@Sun.COM  * CDDL HEADER START
3*10122SJordan.Brown@Sun.COM  *
4*10122SJordan.Brown@Sun.COM  * The contents of this file are subject to the terms of the
5*10122SJordan.Brown@Sun.COM  * Common Development and Distribution License (the "License").
6*10122SJordan.Brown@Sun.COM  * You may not use this file except in compliance with the License.
7*10122SJordan.Brown@Sun.COM  *
8*10122SJordan.Brown@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*10122SJordan.Brown@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*10122SJordan.Brown@Sun.COM  * See the License for the specific language governing permissions
11*10122SJordan.Brown@Sun.COM  * and limitations under the License.
12*10122SJordan.Brown@Sun.COM  *
13*10122SJordan.Brown@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*10122SJordan.Brown@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*10122SJordan.Brown@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*10122SJordan.Brown@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*10122SJordan.Brown@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*10122SJordan.Brown@Sun.COM  *
19*10122SJordan.Brown@Sun.COM  * CDDL HEADER END
20*10122SJordan.Brown@Sun.COM  */
21*10122SJordan.Brown@Sun.COM 
22*10122SJordan.Brown@Sun.COM /*
23*10122SJordan.Brown@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*10122SJordan.Brown@Sun.COM  * Use is subject to license terms.
25*10122SJordan.Brown@Sun.COM  */
26*10122SJordan.Brown@Sun.COM 
27*10122SJordan.Brown@Sun.COM #ifndef _DIRECTORY_PRIVATE_H
28*10122SJordan.Brown@Sun.COM #define	_DIRECTORY_PRIVATE_H
29*10122SJordan.Brown@Sun.COM 
30*10122SJordan.Brown@Sun.COM /*
31*10122SJordan.Brown@Sun.COM  * A suite of functions for retrieving information about objects
32*10122SJordan.Brown@Sun.COM  * in a directory service.
33*10122SJordan.Brown@Sun.COM  */
34*10122SJordan.Brown@Sun.COM 
35*10122SJordan.Brown@Sun.COM #ifdef __cplusplus
36*10122SJordan.Brown@Sun.COM extern "C" {
37*10122SJordan.Brown@Sun.COM #endif
38*10122SJordan.Brown@Sun.COM 
39*10122SJordan.Brown@Sun.COM #include <sys/types.h>
40*10122SJordan.Brown@Sun.COM 
41*10122SJordan.Brown@Sun.COM #define	DIRECTORY_ID_NAME	"n"
42*10122SJordan.Brown@Sun.COM #define	DIRECTORY_ID_USER	"u"
43*10122SJordan.Brown@Sun.COM #define	DIRECTORY_ID_GROUP	"g"
44*10122SJordan.Brown@Sun.COM #define	DIRECTORY_ID_SID	"s"
45*10122SJordan.Brown@Sun.COM 
46*10122SJordan.Brown@Sun.COM /*
47*10122SJordan.Brown@Sun.COM  * Structure of the returned data.
48*10122SJordan.Brown@Sun.COM  * Note that this is constructed from the bottom up; what is returned is
49*10122SJordan.Brown@Sun.COM  * a directory_entry_list_t.
50*10122SJordan.Brown@Sun.COM  */
51*10122SJordan.Brown@Sun.COM typedef void *directory_datum_t;
52*10122SJordan.Brown@Sun.COM typedef directory_datum_t *directory_attribute_value_t;
53*10122SJordan.Brown@Sun.COM typedef struct {
54*10122SJordan.Brown@Sun.COM 	directory_attribute_value_t *attrs;
55*10122SJordan.Brown@Sun.COM 	directory_error_t err;
56*10122SJordan.Brown@Sun.COM } directory_entry_t;
57*10122SJordan.Brown@Sun.COM typedef directory_entry_t *directory_entry_list_t;
58*10122SJordan.Brown@Sun.COM 
59*10122SJordan.Brown@Sun.COM /*
60*10122SJordan.Brown@Sun.COM  * Retrieve information about a user or group.  By way of analogy to exec(2),
61*10122SJordan.Brown@Sun.COM  * the _v variants accept a list of attributes as an array, while
62*10122SJordan.Brown@Sun.COM  * the _l variants accept the attribute list as arguments.
63*10122SJordan.Brown@Sun.COM  * All variations accept a list of identifiers, and return a
64*10122SJordan.Brown@Sun.COM  * directory_entry_list_t in the same order.  The length of the list of user
65*10122SJordan.Brown@Sun.COM  * identifiers can be specified either explicitly, or by a terminating
66*10122SJordan.Brown@Sun.COM  * NULL if the associated count is zero.  Attributes are returned in the
67*10122SJordan.Brown@Sun.COM  * order they were requested, with missing attributes yielding NULL
68*10122SJordan.Brown@Sun.COM  * entries.
69*10122SJordan.Brown@Sun.COM  */
70*10122SJordan.Brown@Sun.COM directory_error_t directory_get_v(directory_t d, directory_entry_list_t *ret,
71*10122SJordan.Brown@Sun.COM     char **ids, int nids, char *types, char **attrlist);
72*10122SJordan.Brown@Sun.COM 
73*10122SJordan.Brown@Sun.COM directory_error_t directory_get_l(directory_t d, directory_entry_list_t *ret,
74*10122SJordan.Brown@Sun.COM     char **ids, int nids, char *types, char *attr1, ...);
75*10122SJordan.Brown@Sun.COM 
76*10122SJordan.Brown@Sun.COM /*
77*10122SJordan.Brown@Sun.COM  * Free the data structure returned by directory_get_by*().
78*10122SJordan.Brown@Sun.COM  *
79*10122SJordan.Brown@Sun.COM  * Does nothing if list==NULL.
80*10122SJordan.Brown@Sun.COM  */
81*10122SJordan.Brown@Sun.COM void directory_free(directory_entry_list_t list);
82*10122SJordan.Brown@Sun.COM 
83*10122SJordan.Brown@Sun.COM /* Return the number of bytes in a directory_datum_t */
84*10122SJordan.Brown@Sun.COM size_t directory_datum_len(directory_datum_t d);
85*10122SJordan.Brown@Sun.COM 
86*10122SJordan.Brown@Sun.COM /*
87*10122SJordan.Brown@Sun.COM  * Search a list, case-insensitively, for a string
88*10122SJordan.Brown@Sun.COM  */
89*10122SJordan.Brown@Sun.COM boolean_t is_in_list(char **list, char *value);
90*10122SJordan.Brown@Sun.COM 
91*10122SJordan.Brown@Sun.COM /*
92*10122SJordan.Brown@Sun.COM  * Examine an objectClass list and distill it into a bitmap of "interesting"
93*10122SJordan.Brown@Sun.COM  * classes.
94*10122SJordan.Brown@Sun.COM  */
95*10122SJordan.Brown@Sun.COM uint64_t class_bitmap(char **objectClass);
96*10122SJordan.Brown@Sun.COM 
97*10122SJordan.Brown@Sun.COM #ifdef __cplusplus
98*10122SJordan.Brown@Sun.COM }
99*10122SJordan.Brown@Sun.COM #endif
100*10122SJordan.Brown@Sun.COM 
101*10122SJordan.Brown@Sun.COM #endif /* _DIRECTORY_PRIVATE_H */
102