xref: /titanic_52/usr/src/lib/libidmap/common/idmap_cache.h (revision 3ee87bca47e74aa2719352485b80973ca6e079b7)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Windows to Solaris Identity Mapping
29  * This header file contains cache definitions.
30  */
31 
32 #ifndef _IDMAP_CACHE_H
33 #define	_IDMAP_CACHE_H
34 
35 
36 #include <sys/avl.h>
37 #include "idmap.h"
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 void
44 idmap_cache_create();
45 
46 void
47 idmap_cache_purge();
48 
49 
50 idmap_stat
51 idmap_cache_lookup_uidbysid(const char *sid_prefix, idmap_rid_t rid,
52 			uid_t *uid);
53 
54 idmap_stat
55 idmap_cache_lookup_gidbysid(const char *sid_prefix, idmap_rid_t rid,
56 			gid_t *gid);
57 
58 idmap_stat
59 idmap_cache_lookup_pidbysid(const char *sid_prefix, idmap_rid_t rid,
60 			uid_t *pid, int *is_user);
61 
62 idmap_stat
63 idmap_cache_lookup_sidbyuid(char **sid_prefix, idmap_rid_t *rid,
64 			uid_t uid);
65 
66 idmap_stat
67 idmap_cache_lookup_sidbygid(char **sid_prefix, idmap_rid_t *rid,
68 			gid_t gid);
69 
70 idmap_stat
71 idmap_cache_lookup_winnamebyuid(char **winname, char **windomain, uid_t uid);
72 
73 idmap_stat
74 idmap_cache_lookup_winnamebygid(char **winname, char **windomain, gid_t gid);
75 
76 idmap_stat
77 idmap_cache_lookup_uidbywinname(const char *winname, const char *windomain,
78 			uid_t *uid);
79 
80 idmap_stat
81 idmap_cache_lookup_gidbywinname(const char *winname, const char *windomain,
82 			gid_t *gid);
83 
84 void
85 idmap_cache_add_sid2uid(const char *sid_prefix, idmap_rid_t rid, uid_t uid,
86 			int direction);
87 
88 void
89 idmap_cache_add_sid2gid(const char *sid_prefix, idmap_rid_t rid, gid_t gid,
90 			int direction);
91 
92 void
93 idmap_cache_add_sid2pid(const char *sid_prefix, idmap_rid_t rid, uid_t pid,
94 			int is_user, int direction);
95 
96 void
97 idmap_cache_add_winname2uid(const char *winname, const char *windomain,
98 			uid_t uid, int direction);
99 
100 void
101 idmap_cache_add_winname2gid(const char *winname, const char *windomain,
102 			gid_t gid, int direction);
103 
104 void
105 idmap_cache_get_data(size_t *uidbysid, size_t *gidbysid, size_t *pidbysid,
106 			size_t *sidbyuid, size_t *sidbygid,
107 			size_t *winnamebyuid, size_t *winnamebygid,
108 			size_t *uidbywinname, size_t *gidbywinname);
109 
110 
111 #ifdef	__cplusplus
112 }
113 #endif
114 
115 #endif	/* _IDMAP_CACHE_H */
116