VsockChannel

Trait VsockChannel 

Source
pub trait VsockChannel {
    // Required methods
    fn recv_pkt(&mut self, pkt: &mut VsockPacketRx) -> Result<(), VsockError>;
    fn send_pkt(&mut self, pkt: &VsockPacketTx) -> Result<(), VsockError>;
    fn has_pending_rx(&self) -> bool;
}
Expand description

Any channel that handles vsock packet traffic: sending and receiving packets. Since we’re implementing the device model here, our responsibility is to always process the sending of packets (i.e. the TX queue). So, any locally generated data, addressed to the driver (e.g. a connection response or RST), will have to be queued, until we get to processing the RX queue.

Note: recv_pkt() and send_pkt() are named analogous to Read::read() and Write::write(), respectively. I.e. - recv_pkt(&mut pkt) will read data from the channel, and place it into pkt; and - send_pkt(&pkt) will fetch data from pkt, and place it into the channel.

Required Methods§

Source

fn recv_pkt(&mut self, pkt: &mut VsockPacketRx) -> Result<(), VsockError>

Read/receive an incoming packet from the channel.

Source

fn send_pkt(&mut self, pkt: &VsockPacketTx) -> Result<(), VsockError>

Write/send a packet through the channel.

Source

fn has_pending_rx(&self) -> bool

Checks whether there is pending incoming data inside the channel, meaning that a subsequent call to recv_pkt() won’t fail.

Implementors§