Skip to main content

SessionLocalServerHandler

Trait SessionLocalServerHandler 

Source
pub trait SessionLocalServerHandler<___T: Transport = Channel> {
    // Required methods
    fn attach(
        &mut self,
        request: Request<Attach, ___T>,
        responder: Responder<Attach, ___T>,
    ) -> impl Future<Output = ()>;
    fn detach(
        &mut self,
        request: Request<Detach, ___T>,
        responder: Responder<Detach, ___T>,
    ) -> impl Future<Output = ()>;
    fn close(&mut self) -> impl Future<Output = ()>;
    fn watch_delegated_rx_lease(
        &mut self,
        responder: Responder<WatchDelegatedRxLease, ___T>,
    ) -> impl Future<Output = ()>;
    fn register_for_tx(
        &mut self,
        request: Request<RegisterForTx, ___T>,
        responder: Responder<RegisterForTx, ___T>,
    ) -> impl Future<Output = ()>;
    fn unregister_for_tx(
        &mut self,
        request: Request<UnregisterForTx, ___T>,
        responder: Responder<UnregisterForTx, ___T>,
    ) -> impl Future<Output = ()>;
}
Expand description

A server handler for the Session protocol.

See Session for more details.

Required Methods§

Source

fn attach( &mut self, request: Request<Attach, ___T>, responder: Responder<Attach, ___T>, ) -> impl Future<Output = ()>

Attaches the session to port.

Once attached, the session starts to receive the subscribed frames over the data FIFOs and it may send frames destined to the specified port.

  • request port port to subscribe to.
  • request rx_frames Frame types of interest on the port.
  • error ZX_ERR_NOT_FOUND if port is not valid.
  • error ZX_ERR_INVALID_ARGS if rx_frames is not a subset of the port’s supported frames.
  • error ZX_ERR_ALREADY_BOUND if port is already attached.
Source

fn detach( &mut self, request: Request<Detach, ___T>, responder: Responder<Detach, ___T>, ) -> impl Future<Output = ()>

Detaches the session from port.

Once detached, the session stops receiving frames from port. Frames sent to a detached port may be returned with an error. It is not necessary to call Detach on ports that are removed from the device, doing so causes ZX_ERR_NOT_FOUND to be returned.

  • request port port to subscribe to.
  • error ZX_ERR_NOT_FOUND if the session is not currently attached to the port.
Source

fn close(&mut self) -> impl Future<Output = ()>

Cleanly closes a session.

This will cause the session to send a ZX_ERR_CANCELLED epitaph and proceed to close the Session channel. Clients may only assume that they own all the buffers that are currently owned by the session (sent over either the rx or tx FIFOs) once the epitaph is received. Closing the rx or tx FIFO is equivalent to calling Close.

Source

fn watch_delegated_rx_lease( &mut self, responder: Responder<WatchDelegatedRxLease, ___T>, ) -> impl Future<Output = ()>

Watchers for delegated receive wakeup leases.

Calls block until a lease is delegated by the device. If a call to WatchDelegatedRxLease is made while a previous call is blocking, the session is closed with ZX_ERR_BAD_STATE. Will never yield any values for sessions created without [SessionFlags.RECEIVE_RX_POWER_LEASES].

Given a single lease is assumed sufficient to keep the system awake, the server only keeps a single lease in its buffer. If a new delegated lease becomes available and the client hasn’t popped the previous one with a call to WatchDelegatedRxLease, the server drops the previously pending lease.

See DelegatedRxLease for how to handle delegated leases.

Source

fn register_for_tx( &mut self, request: Request<RegisterForTx, ___T>, responder: Responder<RegisterForTx, ___T>, ) -> impl Future<Output = ()>

Asks the network device to register the VMO for Tx.

The network device prepares the VMOs in order and stops at the first error if any. It returns how many VMOs have been prepared alongside with the first error encountered. Note that network-device itself does not try to release earlier VMOs for a later error. It is up to the client how to recover from an error.

  • error ZX_ERR_NOT_FOUND if any of the VmoId is unknown.
  • error other zx status that can be reported by the driver.
Source

fn unregister_for_tx( &mut self, request: Request<UnregisterForTx, ___T>, responder: Responder<UnregisterForTx, ___T>, ) -> impl Future<Output = ()>

Tells the device that the client will no longer use the VMO for Tx, if the VMO is also unused for Rx, the device is free to release it at the implementation driver.

The network device processes the VMOs in order and stops at the first error if any. It returns how many VMOs have been marked as unused for Tx alongside with the first error encountered. Note that network-device itself does not try to re-register earlier VMOs for a later error. It is up to the client how to recover from an error.

  • error ZX_ERR_NOT_FOUND if any of the VmoId is unknown.
  • error other zx status that can be reported by the driver.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<___H, ___T> SessionLocalServerHandler<___T> for Local<___H>
where ___H: SessionServerHandler<___T>, ___T: Transport,

Source§

async fn attach( &mut self, request: Request<Attach, ___T>, responder: Responder<Attach, ___T>, )

Source§

async fn detach( &mut self, request: Request<Detach, ___T>, responder: Responder<Detach, ___T>, )

Source§

async fn close(&mut self)

Source§

async fn watch_delegated_rx_lease( &mut self, responder: Responder<WatchDelegatedRxLease, ___T>, )

Source§

async fn register_for_tx( &mut self, request: Request<RegisterForTx, ___T>, responder: Responder<RegisterForTx, ___T>, )

Source§

async fn unregister_for_tx( &mut self, request: Request<UnregisterForTx, ___T>, responder: Responder<UnregisterForTx, ___T>, )

Implementors§