1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use crate::constants::*;
#[derive(Copy, Debug, PartialEq, Eq, Clone)]
pub enum RuleFlags {
FilterUser,
FilterTask,
FilterEntry,
FilterWatch,
FilterExit,
FilterType,
FilterFs,
NrFilters,
FilterPrepend,
Unset,
Unknown(u32),
}
impl From<u32> for RuleFlags {
fn from(value: u32) -> Self {
use self::RuleFlags::*;
match value {
AUDIT_FILTER_USER => FilterUser,
AUDIT_FILTER_TASK => FilterTask,
AUDIT_FILTER_ENTRY => FilterEntry,
AUDIT_FILTER_WATCH => FilterWatch,
AUDIT_FILTER_EXIT => FilterExit,
AUDIT_FILTER_TYPE => FilterType,
AUDIT_FILTER_FS => FilterFs,
AUDIT_NR_FILTERS => NrFilters,
AUDIT_FILTER_PREPEND => FilterPrepend,
AUDIT_FILTER_UNSET => Unset,
_ => Unknown(value),
}
}
}
impl From<RuleFlags> for u32 {
fn from(value: RuleFlags) -> Self {
use self::RuleFlags::*;
match value {
FilterUser => AUDIT_FILTER_USER,
FilterTask => AUDIT_FILTER_TASK,
FilterEntry => AUDIT_FILTER_ENTRY,
FilterWatch => AUDIT_FILTER_WATCH,
FilterExit => AUDIT_FILTER_EXIT,
FilterType => AUDIT_FILTER_TYPE,
FilterFs => AUDIT_FILTER_FS,
NrFilters => AUDIT_NR_FILTERS,
FilterPrepend => AUDIT_FILTER_PREPEND,
Unset => AUDIT_FILTER_UNSET,
Unknown(value) => value,
}
}
}