blob: bce9b877ae799c01172f5d98a536929e06fe26d7 [file] [log] [blame]
Joshua Brindle13cd4c82008-08-19 15:30:36 -04001/*
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;
Stephen Smalley9eb9c932014-02-19 09:16:17 -050028int sidtab_insert(struct sidtab *s, const char * ctx) hidden;
Joshua Brindle13cd4c82008-08-19 15:30:36 -040029
30int sidtab_context_to_sid(struct sidtab *s,
Stephen Smalley9eb9c932014-02-19 09:16:17 -050031 const char * ctx, security_id_t * sid) hidden;
Joshua Brindle13cd4c82008-08-19 15:30:36 -040032
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_ */