shadow_shim_helper_rs/
ipc.rs1use vasi::VirtualAddressSpaceIndependent;
2use vasi_sync::scchannel::SelfContainedChannel;
3
4use crate::shim_event::{ShimEventToShadow, ShimEventToShim};
5
6#[derive(VirtualAddressSpaceIndependent)]
9#[repr(C)]
10pub struct IPCData {
15    shadow_to_plugin: SelfContainedChannel<ShimEventToShim>,
16    plugin_to_shadow: SelfContainedChannel<ShimEventToShadow>,
17}
18
19impl IPCData {
20    pub fn new() -> Self {
21        Self {
22            shadow_to_plugin: SelfContainedChannel::new(),
23            plugin_to_shadow: SelfContainedChannel::new(),
24        }
25    }
26
27    pub fn to_plugin(&self) -> &SelfContainedChannel<ShimEventToShim> {
29        &self.shadow_to_plugin
30    }
31
32    pub fn to_shadow(&self) -> &SelfContainedChannel<ShimEventToShadow> {
34        &self.plugin_to_shadow
35    }
36
37    pub fn from_plugin(&self) -> &SelfContainedChannel<ShimEventToShadow> {
39        &self.plugin_to_shadow
40    }
41
42    pub fn from_shadow(&self) -> &SelfContainedChannel<ShimEventToShim> {
44        &self.shadow_to_plugin
45    }
46}
47
48impl Default for IPCData {
49    fn default() -> Self {
50        Self::new()
51    }
52}