pub struct HostVsockBackend { /* private fields */ }Expand description
Host-side vsock backend for the HV (Hypervisor.framework) backend.
Accepts connections from the guest and forwards them to host-side Unix domain sockets. Each guest port is mapped to a Unix socket path on the host; when the guest opens a connection the backend connects to the corresponding socket and relays data bidirectionally.
This is the primary backend used for arcbox-agent RPC communication on macOS.
Implementations§
Source§impl HostVsockBackend
impl HostVsockBackend
Sourcepub fn add_port_mapping(&mut self, port: u32, socket_path: String)
pub fn add_port_mapping(&mut self, port: u32, socket_path: String)
Registers a mapping from guest vsock port to a host-side Unix socket path.
When the guest opens a connection to port, the backend will connect
to socket_path on the host and relay traffic.
Sourcepub fn with_port_map(port_map: HashMap<u32, String>) -> Self
pub fn with_port_map(port_map: HashMap<u32, String>) -> Self
Creates a backend with pre-configured port mappings.
Trait Implementations§
Source§impl Debug for HostVsockBackend
impl Debug for HostVsockBackend
Source§impl Default for HostVsockBackend
impl Default for HostVsockBackend
Source§impl VsockBackend for HostVsockBackend
impl VsockBackend for HostVsockBackend
Source§fn on_connect(&mut self, addr: VsockAddr) -> Result<()>
fn on_connect(&mut self, addr: VsockAddr) -> Result<()>
Called when guest requests a connection.
Source§fn on_send(&mut self, addr: VsockAddr, data: &[u8]) -> Result<usize>
fn on_send(&mut self, addr: VsockAddr, data: &[u8]) -> Result<usize>
Called when guest sends data.
Source§fn on_recv(&mut self, addr: VsockAddr, buf: &mut [u8]) -> Result<usize>
fn on_recv(&mut self, addr: VsockAddr, buf: &mut [u8]) -> Result<usize>
Called when guest requests data.
Source§fn has_pending_data(&self, addr: VsockAddr) -> bool
fn has_pending_data(&self, addr: VsockAddr) -> bool
Checks if there’s pending data for a connection.
Auto Trait Implementations§
impl Freeze for HostVsockBackend
impl RefUnwindSafe for HostVsockBackend
impl Send for HostVsockBackend
impl Sync for HostVsockBackend
impl Unpin for HostVsockBackend
impl UnsafeUnpin for HostVsockBackend
impl UnwindSafe for HostVsockBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more