endpoint_sec/event/
event_profile_add.rs1use std::ffi::OsStr;
4
5use endpoint_sec_sys::{es_event_profile_add_t, es_profile_source_t, es_profile_t};
6
7use crate::Process;
8
9#[doc(alias = "es_event_profile_add_t")]
11pub struct EventProfileAdd<'a> {
12 pub(crate) raw: &'a es_event_profile_add_t,
14 pub(crate) version: u32,
16}
17
18impl<'a> EventProfileAdd<'a> {
19 #[inline(always)]
21 pub fn instigator(&self) -> Process<'a> {
22 Process::new(unsafe { self.raw.instigator.as_ref() }, self.version)
24 }
25
26 #[inline(always)]
28 pub fn is_update(&self) -> bool {
29 self.raw.is_update
30 }
31
32 #[inline(always)]
34 pub fn profile(&self) -> Profile<'a> {
35 Profile {
36 raw: unsafe { self.raw.profile.as_ref() },
38 }
39 }
40}
41
42unsafe impl Send for EventProfileAdd<'_> {}
44unsafe impl Sync for EventProfileAdd<'_> {}
46
47impl_debug_eq_hash_with_functions!(EventProfileAdd<'a> with version; instigator, is_update, profile);
48
49#[doc(alias = "es_profile_t")]
51pub struct Profile<'a> {
52 pub(crate) raw: &'a es_profile_t,
54}
55
56impl<'a> Profile<'a> {
57 #[inline(always)]
59 pub fn identifier(&self) -> &'a OsStr {
60 unsafe { self.raw.identifier.as_os_str() }
62 }
63
64 #[inline(always)]
66 pub fn uuid(&self) -> &'a OsStr {
67 unsafe { self.raw.uuid.as_os_str() }
69 }
70
71 #[inline(always)]
73 pub fn install_source(&self) -> es_profile_source_t {
74 self.raw.install_source
75 }
76
77 #[inline(always)]
79 pub fn organization(&self) -> &'a OsStr {
80 unsafe { self.raw.organization.as_os_str() }
82 }
83
84 #[inline(always)]
86 pub fn display_name(&self) -> &'a OsStr {
87 unsafe { self.raw.display_name.as_os_str() }
89 }
90
91 #[inline(always)]
93 pub fn scope(&self) -> &'a OsStr {
94 unsafe { self.raw.scope.as_os_str() }
96 }
97}
98
99unsafe impl Send for Profile<'_> {}
101
102impl_debug_eq_hash_with_functions!(Profile<'a>; identifier, uuid, install_source, organization, display_name, scope);