pub trait NetworkDeviceImplLocalServerHandler<___T: Transport = DriverChannel> {
// Required methods
fn init(
&mut self,
request: Request<Init, ___T>,
responder: Responder<Init, ___T>,
) -> impl Future<Output = ()>;
fn start(
&mut self,
responder: Responder<Start, ___T>,
) -> impl Future<Output = ()>;
fn stop(
&mut self,
responder: Responder<Stop, ___T>,
) -> impl Future<Output = ()>;
fn get_info(
&mut self,
responder: Responder<GetInfo, ___T>,
) -> impl Future<Output = ()>;
fn queue_tx(
&mut self,
request: Request<QueueTx, ___T>,
) -> impl Future<Output = ()>;
fn queue_rx_space(
&mut self,
request: Request<QueueRxSpace, ___T>,
) -> impl Future<Output = ()>;
fn prepare_vmo(
&mut self,
request: Request<PrepareVmo, ___T>,
responder: Responder<PrepareVmo, ___T>,
) -> impl Future<Output = ()>;
fn release_vmo(
&mut self,
request: Request<ReleaseVmo, ___T>,
responder: Responder<ReleaseVmo, ___T>,
) -> impl Future<Output = ()>;
}Expand description
A server handler for the NetworkDeviceImpl protocol.
See NetworkDeviceImpl for more details.
Required Methods§
Sourcefn init(
&mut self,
request: Request<Init, ___T>,
responder: Responder<Init, ___T>,
) -> impl Future<Output = ()>
fn init( &mut self, request: Request<Init, ___T>, responder: Responder<Init, ___T>, ) -> impl Future<Output = ()>
Initializes the network device.
Init is only called once during the lifetime of the device to register
iface as the callback target for the Network Device implementation.
Upon initialization, the device is expected to be in the “Stopped”
state, the Start method will be called once the data path needs to be
opened.
- request
ifacehandle to the device interface.
- response
sinitialization status. A value other thanZX_OKwill cause the device to unbind.
Sourcefn start(
&mut self,
responder: Responder<Start, ___T>,
) -> impl Future<Output = ()>
fn start( &mut self, responder: Responder<Start, ___T>, ) -> impl Future<Output = ()>
Starts the device’s data path.
start signals to the device implementation that it should bring up its
data path and be ready to receive tx frames and iface will start
accepting rx frames.
The device is only considered started once Start returns successfully.
Until then, the contract guarantees that no other data-path calls will
be made to the device (QueueTx, RxAvailable, Stop, or a second
call to Start), so implementers can safely assume or assert that this
contract is upheld.
- response
sstart status.ZX_OKindicates a successful start.ZX_ERR_ALREADY_BOUNDindicates that the device has already been successfully started. Any other status value indicates an implementation specific error.
Sourcefn stop(&mut self, responder: Responder<Stop, ___T>) -> impl Future<Output = ()>
fn stop(&mut self, responder: Responder<Stop, ___T>) -> impl Future<Output = ()>
Stops the network device.
The device implementation must return all outstanding Tx and Rx buffers
upon receiving this call. Any new buffers received in the stopped state
must be returned with an appropriate error (tx) or unfulfilled (rx). See
[NetworkDeviceIfc.CompleteTx] and [NetworkDeviceIfc.CompleteRx] for
details.
The device implementation may perform any power saving measures after observing stop.
Sourcefn get_info(
&mut self,
responder: Responder<GetInfo, ___T>,
) -> impl Future<Output = ()>
fn get_info( &mut self, responder: Responder<GetInfo, ___T>, ) -> impl Future<Output = ()>
Gets information about the device.
Device information must not change over the course of the lifetime of the device.
- response
infodevice information.
Sourcefn queue_tx(
&mut self,
request: Request<QueueTx, ___T>,
) -> impl Future<Output = ()>
fn queue_tx( &mut self, request: Request<QueueTx, ___T>, ) -> impl Future<Output = ()>
Enqueues a list of buffers for transmission on the network device.
The driver takes ownership of the buffer and must complete the tx
transaction by using [NetworkDeviceIfc.CompleteTx] operations once it
is done with each buffer in buffers.
The total number of outstanding tx buffers given to a device will never
exceed the reported [DeviceInfo.tx_depth] value. Which also means that
no more than tx_depth buffers are going to be informed at once in a
single call to QueueTx.
Buffers enqueued while the device in is the stopped state must be
returned with an appropriate error. See [TxResult.status] for specific
error codes.
- request
bufferstx buffers to enqueue for sending.
Sourcefn queue_rx_space(
&mut self,
request: Request<QueueRxSpace, ___T>,
) -> impl Future<Output = ()>
fn queue_rx_space( &mut self, request: Request<QueueRxSpace, ___T>, ) -> impl Future<Output = ()>
Enqueues a list of rx buffer space on the network device.
The driver takes ownership of the buffer and must complete the
transaction (once network data arrives) using
[NetworkDeviceIfc.CompleteRx].
The total number of outstanding rx buffers given to a device will never
exceed the reported [DeviceInfo.rx_depth] value. Which also means that
no more than rx_depth buffers are going to be informed at once in a
single call to QueueRxSpace.
Buffers enqueued while the device in is the stopped state must be returned with a zero length.
- request
buffersrx space buffers to be filled with network data when it arrives.
Sourcefn prepare_vmo(
&mut self,
request: Request<PrepareVmo, ___T>,
responder: Responder<PrepareVmo, ___T>,
) -> impl Future<Output = ()>
fn prepare_vmo( &mut self, request: Request<PrepareVmo, ___T>, responder: Responder<PrepareVmo, ___T>, ) -> impl Future<Output = ()>
Informs device that a new VMO is being used to store frame data.
Implementers must store the VMO handle referenced by id until
[NetworkDeviceImpl.ReleaseVmo] is called with the same id.
- request
ididentifier used to reference this VMO. - request
vmoVMO where frame data will be stored.
- response
svmo registration status.ZX_OKindicates a successful VMO preparation. Any other status value indicates an implementation specific error and causes the client session which owns the VMO to be closed.
Sourcefn release_vmo(
&mut self,
request: Request<ReleaseVmo, ___T>,
responder: Responder<ReleaseVmo, ___T>,
) -> impl Future<Output = ()>
fn release_vmo( &mut self, request: Request<ReleaseVmo, ___T>, responder: Responder<ReleaseVmo, ___T>, ) -> impl Future<Output = ()>
Device may dispose of all references to the VMO referenced by id.
No more buffers will be sent with this id.
ReleaseVmo is guaranteed to only be called when the implementation
holds no buffers that reference that id.
- request
idVMO identifier.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".