endpoint_sec/event/
event_tcc_modify.rs1use std::ffi::OsStr;
4
5use endpoint_sec_sys::{es_event_tcc_modify_t, es_tcc_identity_type_t, es_tcc_event_type_t, es_tcc_authorization_right_t, es_tcc_authorization_reason_t};
6
7use crate::{AuditToken, Process};
8
9#[doc(alias = "es_event_tcc_modify_t")]
15pub struct EventTccModify<'a> {
16 pub(super) raw: &'a es_event_tcc_modify_t,
18 pub(crate) version: u32,
20}
21
22impl<'a> EventTccModify<'a> {
23 #[inline(always)]
25 pub fn service(&self) -> &'a OsStr {
26 unsafe { self.raw.service.as_os_str() }
28 }
29
30 #[inline(always)]
32 pub fn identity(&self) -> &'a OsStr {
33 unsafe { self.raw.identity.as_os_str() }
35 }
36
37 #[inline(always)]
39 pub fn identity_type(&self) -> es_tcc_identity_type_t {
40 self.raw.identity_type
41 }
42
43 #[inline(always)]
45 pub fn update_type(&self) -> es_tcc_event_type_t {
46 self.raw.update_type
47 }
48
49 #[inline(always)]
51 pub fn instigator_token(&self) -> AuditToken {
52 AuditToken(self.raw.instigator_token)
53 }
54
55 #[inline(always)]
57 pub fn instigator(&self) -> Option<Process<'a>> {
58 let process = unsafe { self.raw.instigator()? };
60 Some(Process::new(process, self.version))
61 }
62
63 #[inline(always)]
65 pub fn responsible_token(&self) -> Option<AuditToken> {
66 let token = unsafe { self.raw.responsible_token()? };
67 Some(AuditToken(*token))
68 }
69
70 #[inline(always)]
72 pub fn responsible(&self) -> Option<Process<'a>> {
73 let process = unsafe { self.raw.responsible()? };
75 Some(Process::new(process, self.version))
76 }
77
78 #[inline(always)]
80 pub fn right(&self) -> es_tcc_authorization_right_t {
81 self.raw.right
82 }
83
84 #[inline(always)]
86 pub fn reason(&self) -> es_tcc_authorization_reason_t {
87 self.raw.reason
88 }
89}
90
91unsafe impl Send for EventTccModify<'_> {}
93unsafe impl Sync for EventTccModify<'_> {}
95
96impl_debug_eq_hash_with_functions!(EventTccModify<'a>; service, identity, identity_type, update_type, instigator_token, instigator, responsible_token, responsible, right, reason);