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#include "dso.h"
11
12struct sidtab_node {
13	struct security_id sid_s;
14	struct sidtab_node *next;
15};
16
17#define SIDTAB_HASH_BITS 7
18#define SIDTAB_HASH_BUCKETS (1 << SIDTAB_HASH_BITS)
19#define SIDTAB_HASH_MASK (SIDTAB_HASH_BUCKETS-1)
20#define SIDTAB_SIZE SIDTAB_HASH_BUCKETS
21
22struct sidtab {
23	struct sidtab_node **htable;
24	unsigned nel;
25};
26
27int sidtab_init(struct sidtab *s) hidden;
28int sidtab_insert(struct sidtab *s, security_context_t ctx) hidden;
29
30int sidtab_context_to_sid(struct sidtab *s,
31			  security_context_t ctx, security_id_t * sid) hidden;
32
33void sidtab_sid_stats(struct sidtab *s, char *buf, int buflen) hidden;
34void sidtab_destroy(struct sidtab *s) hidden;
35
36#endif				/* _SELINUX_AVC_SIDTAB_H_ */
37