use vasi::VirtualAddressSpaceIndependent;
use vasi_sync::scchannel::SelfContainedChannel;
use crate::shim_event::{ShimEventToShadow, ShimEventToShim};
#[derive(VirtualAddressSpaceIndependent)]
#[repr(C)]
pub struct IPCData {
shadow_to_plugin: SelfContainedChannel<ShimEventToShim>,
plugin_to_shadow: SelfContainedChannel<ShimEventToShadow>,
}
impl IPCData {
pub fn new() -> Self {
Self {
shadow_to_plugin: SelfContainedChannel::new(),
plugin_to_shadow: SelfContainedChannel::new(),
}
}
pub fn to_plugin(&self) -> &SelfContainedChannel<ShimEventToShim> {
&self.shadow_to_plugin
}
pub fn to_shadow(&self) -> &SelfContainedChannel<ShimEventToShadow> {
&self.plugin_to_shadow
}
pub fn from_plugin(&self) -> &SelfContainedChannel<ShimEventToShadow> {
&self.plugin_to_shadow
}
pub fn from_shadow(&self) -> &SelfContainedChannel<ShimEventToShim> {
&self.shadow_to_plugin
}
}
impl Default for IPCData {
fn default() -> Self {
Self::new()
}
}