endpoint_sec/event/
event_screesharing_attach.rs1use std::ffi::OsStr;
4use std::net::IpAddr;
5use std::str::FromStr;
6
7use endpoint_sec_sys::{es_address_type_t, es_event_screensharing_attach_t, es_graphical_session_id_t};
8
9#[doc(alias = "es_event_screensharing_attach_t")]
11pub struct EventScreensharingAttach<'a> {
12 pub(crate) raw: &'a es_event_screensharing_attach_t,
14}
15
16impl<'a> EventScreensharingAttach<'a> {
17 #[inline(always)]
19 pub fn success(&self) -> bool {
20 self.raw.success
21 }
22
23 #[inline(always)]
25 pub fn source_address_type(&self) -> es_address_type_t {
26 self.raw.source_address_type
27 }
28
29 #[inline(always)]
32 pub fn source_address(&self) -> &'a OsStr {
33 unsafe { self.raw.source_address.as_os_str() }
35 }
36
37 #[inline(always)]
41 pub fn viewer_appleid(&self) -> &'a OsStr {
42 unsafe { self.raw.viewer_appleid.as_os_str() }
44 }
45
46 #[inline(always)]
48 pub fn authentication_type(&self) -> &'a OsStr {
49 unsafe { self.raw.authentication_type.as_os_str() }
51 }
52
53 #[inline(always)]
56 pub fn authentication_username(&self) -> &'a OsStr {
57 unsafe { self.raw.authentication_username.as_os_str() }
59 }
60
61 #[inline(always)]
63 pub fn session_username(&self) -> &'a OsStr {
64 unsafe { self.raw.session_username.as_os_str() }
66 }
67
68 #[inline(always)]
70 pub fn existing_session(&self) -> bool {
71 self.raw.existing_session
72 }
73
74 #[inline(always)]
76 pub fn graphical_session_id(&self) -> es_graphical_session_id_t {
77 self.raw.graphical_session_id
78 }
79
80 #[inline(always)]
82 pub fn source_address_std(&self) -> Option<IpAddr> {
83 let sa = self.source_address().to_str()?;
84 IpAddr::from_str(sa).ok()
85 }
86}
87
88unsafe impl Send for EventScreensharingAttach<'_> {}
90unsafe impl Sync for EventScreensharingAttach<'_> {}
92
93impl_debug_eq_hash_with_functions!(
94 EventScreensharingAttach<'a>;
95 success, source_address_type, source_address, viewer_appleid, authentication_type,
96 authentication_username, session_username, existing_session, graphical_session_id,
97);