xref: /titanic_41/usr/src/uts/common/idmap/kidmap_priv.h (revision bd0f52d78d701efcad2c460df61b45677d041c35)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Windows to Solaris Identity Mapping kernel API
29  * This header file contains private definitions.
30  */
31 
32 #ifndef _KIDMAP_PRIV_H
33 #define	_KIDMAP_PRIV_H
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36 
37 #include <sys/avl.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 enum	cache_state { 	CACHE_CREATED,
44 			CACHE_PURGING,
45 			CACHE_DESTROYING };
46 
47 typedef struct idmap_avl_cache {
48 	avl_tree_t		tree;
49 	krwlock_t		lock;
50 	kmutex_t		mutex;
51 	enum cache_state	state;
52 	time_t			purge_time;
53 } idmap_avl_cache_t;
54 
55 typedef struct idmap_cache {
56 	idmap_avl_cache_t	sid;
57 	idmap_avl_cache_t	pid;
58 } idmap_cache_t;
59 
60 
61 void
62 kidmap_cache_create(idmap_cache_t *cache);
63 
64 void
65 kidmap_cache_delete(idmap_cache_t *cache);
66 
67 int
68 kidmap_cache_lookupbypid(idmap_cache_t *cache, const char **sid_prefix,
69 			uint32_t *rid, uid_t pid, int is_user);
70 
71 int
72 kidmap_cache_lookupbysid(idmap_cache_t *cache, const char *sid_prefix,
73 			uint32_t rid, uid_t *pid, int *is_user);
74 
75 void
76 kidmap_cache_addbypid(idmap_cache_t *cache, const char *sid_prefix,
77 			uint32_t rid, uid_t pid, int is_user, time_t ttl);
78 
79 void
80 kidmap_cache_addbysid(idmap_cache_t *cache, const char *sid_prefix,
81 			uint32_t rid, uid_t pid, int is_user, time_t ttl);
82 
83 int
84 kidmap_start(void);
85 
86 int
87 kidmap_stop(void);
88 
89 void
90 kidmap_sid_prefix_store_init(void);
91 
92 const char *
93 kidmap_find_sid_prefix(const char *sid_prefix);
94 
95 #ifdef	__cplusplus
96 }
97 #endif
98 
99 #endif	/* _KIDMAP_PRIV_H */
100