aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/avtab.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /security/selinux/ss/avtab.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'security/selinux/ss/avtab.h')
-rw-r--r--security/selinux/ss/avtab.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/security/selinux/ss/avtab.h b/security/selinux/ss/avtab.h
new file mode 100644
index 000000000000..519d4f6dc655
--- /dev/null
+++ b/security/selinux/ss/avtab.h
@@ -0,0 +1,85 @@
1/*
2 * An access vector table (avtab) is a hash table
3 * of access vectors and transition types indexed
4 * by a type pair and a class. An access vector
5 * table is used to represent the type enforcement
6 * tables.
7 *
8 * Author : Stephen Smalley, <sds@epoch.ncsc.mil>
9 */
10
11/* Updated: Frank Mayer <mayerf@tresys.com> and Karl MacMillan <kmacmillan@tresys.com>
12 *
13 * Added conditional policy language extensions
14 *
15 * Copyright (C) 2003 Tresys Technology, LLC
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation, version 2.
19 */
20#ifndef _SS_AVTAB_H_
21#define _SS_AVTAB_H_
22
23struct avtab_key {
24 u32 source_type; /* source type */
25 u32 target_type; /* target type */
26 u32 target_class; /* target object class */
27};
28
29struct avtab_datum {
30#define AVTAB_ALLOWED 1
31#define AVTAB_AUDITALLOW 2
32#define AVTAB_AUDITDENY 4
33#define AVTAB_AV (AVTAB_ALLOWED | AVTAB_AUDITALLOW | AVTAB_AUDITDENY)
34#define AVTAB_TRANSITION 16
35#define AVTAB_MEMBER 32
36#define AVTAB_CHANGE 64
37#define AVTAB_TYPE (AVTAB_TRANSITION | AVTAB_MEMBER | AVTAB_CHANGE)
38#define AVTAB_ENABLED 0x80000000 /* reserved for used in cond_avtab */
39 u32 specified; /* what fields are specified */
40 u32 data[3]; /* access vectors or types */
41#define avtab_allowed(x) (x)->data[0]
42#define avtab_auditdeny(x) (x)->data[1]
43#define avtab_auditallow(x) (x)->data[2]
44#define avtab_transition(x) (x)->data[0]
45#define avtab_change(x) (x)->data[1]
46#define avtab_member(x) (x)->data[2]
47};
48
49struct avtab_node {
50 struct avtab_key key;
51 struct avtab_datum datum;
52 struct avtab_node *next;
53};
54
55struct avtab {
56 struct avtab_node **htable;
57 u32 nel; /* number of elements */
58};
59
60int avtab_init(struct avtab *);
61struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *k, int specified);
62void avtab_destroy(struct avtab *h);
63void avtab_hash_eval(struct avtab *h, char *tag);
64
65int avtab_read_item(void *fp, struct avtab_datum *avdatum, struct avtab_key *avkey);
66int avtab_read(struct avtab *a, void *fp, u32 config);
67
68struct avtab_node *avtab_insert_nonunique(struct avtab *h, struct avtab_key *key,
69 struct avtab_datum *datum);
70
71struct avtab_node *avtab_search_node(struct avtab *h, struct avtab_key *key, int specified);
72
73struct avtab_node *avtab_search_node_next(struct avtab_node *node, int specified);
74
75void avtab_cache_init(void);
76void avtab_cache_destroy(void);
77
78#define AVTAB_HASH_BITS 15
79#define AVTAB_HASH_BUCKETS (1 << AVTAB_HASH_BITS)
80#define AVTAB_HASH_MASK (AVTAB_HASH_BUCKETS-1)
81
82#define AVTAB_SIZE AVTAB_HASH_BUCKETS
83
84#endif /* _SS_AVTAB_H_ */
85