options.bend

bend-osdev-apparmor@0.1.0.0 · 44 lines · 8 definitions

1# bend-osdev-apparmor: the choices a caller can make, with the documented
2# behaviour as the default.
3import Base
4
5# a variable and its values, as @{NAME} = v1 v2 ... assigns them
6type AaVar is Data:
7  AaVar{name: List<&2, U32>, values: List<&2, List<&2, U32>>}
8
9# complain_deny: deny rules still deny in complain mode (apparmor(7),
10# "Complain mode": "deny rules will still result in denials"); False makes
11# complain mode allow everything.
12# depth: how deeply includes may nest.
13# vars: variables defined before any file is read (the tunables a system
14# provides, when the file map does not hold them).
15type AaOptions is Data:
16  AaOptions{complain_deny: Bool, depth: Nat, vars: List<&2, AaVar>}
17
18def AaOptions.default() -> AaOptions:
19  AaOptions{True{}, 32n, Nil{}}
20
21def AaOptions.complain_deny(o: AaOptions) -> Bool:
22  match o:
23    case AaOptions{c, d, v}:
24      c
25
26def AaOptions.depth(o: AaOptions) -> Nat:
27  match o:
28    case AaOptions{c, d, v}:
29      d
30
31def AaOptions.vars(o: AaOptions) -> List<&2, AaVar>:
32  match o:
33    case AaOptions{c, d, v}:
34      v
35
36def AaOptions.with_complain_deny(o: AaOptions, b: Bool) -> AaOptions:
37  match o:
38    case AaOptions{c, d, v}:
39      AaOptions{b, d, v}
40
41def AaOptions.with_vars(o: AaOptions, vs: List<&2, AaVar>) -> AaOptions:
42  match o:
43    case AaOptions{c, d, v}:
44      AaOptions{c, d, vs}