pub struct FrontendClient {
    sock: Connection<BackendReq>,
    reply_ack_negotiated: bool,
    error: Option<i32>,
}
Expand description

Client for a vhost-user frontend. Allows a backend to send requests to the frontend.

Fields§

§sock: Connection<BackendReq>§reply_ack_negotiated: bool§error: Option<i32>

Implementations§

source§

impl FrontendClient

source

pub fn new(ep: Connection<BackendReq>) -> Self

Create a new instance from the given connection.

source

fn send_message<T>( &mut self, request: BackendReq, msg: &T, fds: Option<&[RawDescriptor]> ) -> HandlerResult<u64>
where T: AsBytes,

source

fn wait_for_reply( &mut self, hdr: &VhostUserMsgHeader<BackendReq> ) -> Result<u64>

source

pub fn set_reply_ack_flag(&mut self, enable: bool)

Set the negotiation state of the VHOST_USER_PROTOCOL_F_REPLY_ACK protocol feature.

When the VHOST_USER_PROTOCOL_F_REPLY_ACK protocol feature has been negotiated, the “REPLY_ACK” flag will be set in the message header for every backend to frontend request message.

source

pub fn set_failed(&mut self, error: i32)

Mark connection as failed with specified error code.

Trait Implementations§

source§

impl Frontend for FrontendClient

source§

fn shmem_map( &mut self, req: &VhostUserShmemMapMsg, fd: &dyn AsRawDescriptor ) -> HandlerResult<u64>

Handle shared memory region mapping requests.

source§

fn shmem_unmap(&mut self, req: &VhostUserShmemUnmapMsg) -> HandlerResult<u64>

Handle shared memory region unmapping requests.

source§

fn handle_config_change(&mut self) -> HandlerResult<u64>

Handle config change requests.

source§

fn gpu_map( &mut self, req: &VhostUserGpuMapMsg, descriptor: &dyn AsRawDescriptor ) -> HandlerResult<u64>

Handle GPU shared memory region mapping requests.

source§

fn external_map(&mut self, req: &VhostUserExternalMapMsg) -> HandlerResult<u64>

Handle external memory region mapping requests.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.