debuggers.hg

view xen/xsm/flask/ss/avtab.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children b22f9ab1716a
line source
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 */
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 */
21 /* Ported to Xen 3.0, George Coker, <gscoker@alpha.ncsc.mil> */
23 #ifndef _SS_AVTAB_H_
24 #define _SS_AVTAB_H_
26 struct avtab_key {
27 u16 source_type; /* source type */
28 u16 target_type; /* target type */
29 u16 target_class; /* target object class */
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_OLD 0x80000000 /* reserved for used in cond_avtab */
39 #define AVTAB_ENABLED 0x8000 /* reserved for used in cond_avtab */
40 u16 specified; /* what field is specified */
41 };
43 struct avtab_datum {
44 u32 data; /* access vector or type value */
45 };
47 struct avtab_node {
48 struct avtab_key key;
49 struct avtab_datum datum;
50 struct avtab_node *next;
51 };
53 struct avtab {
54 struct avtab_node **htable;
55 u32 nel; /* number of elements */
56 };
58 int avtab_init(struct avtab *);
59 struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *k);
60 void avtab_destroy(struct avtab *h);
61 void avtab_hash_eval(struct avtab *h, char *tag);
63 int avtab_read_item(void *fp, uint32_t vers, struct avtab *a,
64 int (*insert)(struct avtab *a, struct avtab_key *k,
65 struct avtab_datum *d, void *p),
66 void *p);
68 int avtab_read(struct avtab *a, void *fp, u32 vers);
70 struct avtab_node *avtab_insert_nonunique(struct avtab *h,
71 struct avtab_key *key, struct avtab_datum *datum);
73 struct avtab_node *avtab_search_node(struct avtab *h, struct avtab_key *key);
75 struct avtab_node *avtab_search_node_next(struct avtab_node *node,
76 int specified);
78 #define AVTAB_HASH_BITS 15
79 #define AVTAB_HASH_BUCKETS (1 << AVTAB_HASH_BITS)
80 #define AVTAB_HASH_MASK (AVTAB_HASH_BUCKETS-1)
82 #define AVTAB_SIZE AVTAB_HASH_BUCKETS
84 #endif /* _SS_AVTAB_H_ */