pub struct DeviceProxy { /* private fields */ }Implementations§
Source§impl DeviceProxy
impl DeviceProxy
Sourcepub fn take_event_stream(&self) -> DeviceEventStream
pub fn take_event_stream(&self) -> DeviceEventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
Sourcepub fn write_frame(
&self,
frame: &Frame,
) -> QueryResponseFut<DeviceWriteFrameResult, DefaultFuchsiaResourceDialect> ⓘ
pub fn write_frame( &self, frame: &Frame, ) -> QueryResponseFut<DeviceWriteFrameResult, DefaultFuchsiaResourceDialect> ⓘ
Writes a frame to the device (data coming from network-end).
If the device was created with the
[fuchsia.net.tun/DeviceConfig.blocking] option set to true, calls to
WriteFrame block until there is one buffer available to fulfill the
request.
- request
frameinbound frame data and metadata.
- error
ZX_ERR_NOT_FOUNDif [Frame.port] references an unknown port. - error
ZX_ERR_INVALID_ARGSifframeis invalid. - error
ZX_ERR_BAD_STATEif the device is offline. - error
ZX_ERR_NO_RESOURCESif more than [fuchsia.net.tun/MAX_PENDING_OPERATIONS] calls toWriteFrameare pending. - error
ZX_ERR_SHOULD_WAITifblockingis set tofalseand there are no buffers available to fulfill the request.
Sourcepub fn read_frame(
&self,
) -> QueryResponseFut<DeviceReadFrameResult, DefaultFuchsiaResourceDialect> ⓘ
pub fn read_frame( &self, ) -> QueryResponseFut<DeviceReadFrameResult, DefaultFuchsiaResourceDialect> ⓘ
Gets the next frame from the device (data coming from host-end).
If the device was created with the
[fuchsia.net.tun/DeviceConfig.blocking] option set to true, calls to
ReadFrame block until there is a frame available to be read.
- response
frameoutbound frame data and metadata.
- error
ZX_ERR_NO_RESOURCESif more than [fuchsia.net.tun/MAX_PENDING_OPERATIONS] calls toReadFrameare pending. - error
ZX_ERR_SHOULD_WAITifblockingis set tofalseand there are no frames to be read.
Sourcepub fn get_signals(
&self,
) -> QueryResponseFut<EventPair, DefaultFuchsiaResourceDialect> ⓘ
pub fn get_signals( &self, ) -> QueryResponseFut<EventPair, DefaultFuchsiaResourceDialect> ⓘ
Retrieves signals eventpair.
- response
signalsan eventpair that is signalled withSIGNAL_READABLEandSIGNAL_WRITABLEwhen read and write buffers are available, respectively.
Sourcepub fn add_port(
&self,
config: &DevicePortConfig,
port: ServerEnd<PortMarker>,
) -> Result<(), Error>
pub fn add_port( &self, config: &DevicePortConfig, port: ServerEnd<PortMarker>, ) -> Result<(), Error>
Creates a new port on this device.
- request
confignew port configuration. - request
portgrants control over the port. Closed with an epitaph ifconfigis not valid.
Sourcepub fn get_device(&self, device: ServerEnd<DeviceMarker>) -> Result<(), Error>
pub fn get_device(&self, device: ServerEnd<DeviceMarker>) -> Result<(), Error>
Connects to the underlying device endpoint.
- request
devicedevice handle.
Sourcepub fn delegate_rx_lease(&self, lease: DelegatedRxLease) -> Result<(), Error>
pub fn delegate_rx_lease(&self, lease: DelegatedRxLease) -> Result<(), Error>
Delegates an rx lease through the tun device.
See documentation on [fuchsia.hardware.network/DelegatedRxLease] for
proper usage.
Trait Implementations§
Source§impl Clone for DeviceProxy
impl Clone for DeviceProxy
Source§impl Debug for DeviceProxy
impl Debug for DeviceProxy
Source§impl DeviceProxyInterface for DeviceProxy
impl DeviceProxyInterface for DeviceProxy
type WriteFrameResponseFut = QueryResponseFut<Result<(), i32>>
type ReadFrameResponseFut = QueryResponseFut<Result<Frame, i32>>
type GetSignalsResponseFut = QueryResponseFut<EventPair>
fn write_frame(&self, frame: &Frame) -> Self::WriteFrameResponseFut
fn read_frame(&self) -> Self::ReadFrameResponseFut
fn get_signals(&self) -> Self::GetSignalsResponseFut
fn add_port( &self, config: &DevicePortConfig, port: ServerEnd<PortMarker>, ) -> Result<(), Error>
fn get_device(&self, device: ServerEnd<DeviceMarker>) -> Result<(), Error>
fn delegate_rx_lease(&self, lease: DelegatedRxLease) -> Result<(), Error>
Source§impl Proxy for DeviceProxy
impl Proxy for DeviceProxy
Source§type Protocol = DeviceMarker
type Protocol = DeviceMarker
Proxy controls.