• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * A security identifier table (sidtab) is a hash table
3  * of security context structures indexed by SID value.
4  */
5 #ifndef _SELINUX_AVC_SIDTAB_H_
6 #define _SELINUX_AVC_SIDTAB_H_
7 
8 #include <selinux/selinux.h>
9 #include <selinux/avc.h>
10 
11 struct sidtab_node {
12 	struct security_id sid_s;
13 	struct sidtab_node *next;
14 };
15 
16 #define SIDTAB_HASH_BITS 7
17 #define SIDTAB_HASH_BUCKETS (1 << SIDTAB_HASH_BITS)
18 #define SIDTAB_HASH_MASK (SIDTAB_HASH_BUCKETS-1)
19 #define SIDTAB_SIZE SIDTAB_HASH_BUCKETS
20 
21 struct sidtab {
22 	struct sidtab_node **htable;
23 	unsigned nel;
24 };
25 
26 int sidtab_init(struct sidtab *s) ;
27 int sidtab_insert(struct sidtab *s, const char * ctx) ;
28 
29 int sidtab_context_to_sid(struct sidtab *s,
30 			  const char * ctx, security_id_t * sid) ;
31 
32 void sidtab_sid_stats(struct sidtab *s, char *buf, int buflen) ;
33 void sidtab_destroy(struct sidtab *s) ;
34 
35 #endif				/* _SELINUX_AVC_SIDTAB_H_ */
36