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
11struct 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
21struct sidtab {
22	struct sidtab_node **htable;
23	unsigned nel;
24};
25
26int sidtab_init(struct sidtab *s) ;
27int sidtab_insert(struct sidtab *s, const char * ctx) ;
28
29int sidtab_context_to_sid(struct sidtab *s,
30			  const char * ctx, security_id_t * sid) ;
31
32void sidtab_sid_stats(struct sidtab *s, char *buf, int buflen) ;
33void sidtab_destroy(struct sidtab *s) ;
34
35#endif				/* _SELINUX_AVC_SIDTAB_H_ */
36