pub struct DeviceSynchronousProxy { /* private fields */ }
Implementations§
Source§impl DeviceSynchronousProxy
impl DeviceSynchronousProxy
pub fn new(channel: Channel) -> Self
pub fn into_channel(self) -> Channel
Sourcepub fn wait_for_event(
&self,
deadline: MonotonicInstant,
) -> Result<DeviceEvent, Error>
pub fn wait_for_event( &self, deadline: MonotonicInstant, ) -> Result<DeviceEvent, Error>
Waits until an event arrives and returns it. It is safe for other threads to make concurrent requests while waiting for an event.
Sourcepub fn write_frame(
&self,
frame: &Frame,
___deadline: MonotonicInstant,
) -> Result<DeviceWriteFrameResult, Error>
pub fn write_frame( &self, frame: &Frame, ___deadline: MonotonicInstant, ) -> Result<DeviceWriteFrameResult, Error>
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
frame
inbound frame data and metadata.
- error
ZX_ERR_NOT_FOUND
if [Frame.port
] references an unknown port. - error
ZX_ERR_INVALID_ARGS
ifframe
is invalid. - error
ZX_ERR_BAD_STATE
if the device is offline. - error
ZX_ERR_BAD_STATE
if the device is offline. - error
ZX_ERR_NO_RESOURCES
if more than [fuchsia.net.tun/MAX_PENDING_OPERATIONS
] calls toWriteFrame
are pending. - error
ZX_ERR_SHOULD_WAIT
ifblocking
is set tofalse
and there are no buffers available to fulfill the request.
Sourcepub fn read_frame(
&self,
___deadline: MonotonicInstant,
) -> Result<DeviceReadFrameResult, Error>
pub fn read_frame( &self, ___deadline: MonotonicInstant, ) -> Result<DeviceReadFrameResult, Error>
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
frame
outbound frame data and metadata.
- error
ZX_ERR_NO_RESOURCES
if more than [fuchsia.net.tun/MAX_PENDING_OPERATIONS
] calls toReadFrame
are pending. - error
ZX_ERR_SHOULD_WAIT
ifblocking
is set tofalse
and there are no frames to be read.
Sourcepub fn get_signals(
&self,
___deadline: MonotonicInstant,
) -> Result<EventPair, Error>
pub fn get_signals( &self, ___deadline: MonotonicInstant, ) -> Result<EventPair, Error>
Retrieves signals eventpair.
- response
signals
an eventpair that is signalled withSIGNAL_READABLE
andSIGNAL_WRITABLE
when 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
config
new port configuration. - request
port
grants control over the port. Closed with an epitaph ifconfig
is 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
device
device 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 Debug for DeviceSynchronousProxy
impl Debug for DeviceSynchronousProxy
Source§impl SynchronousProxy for DeviceSynchronousProxy
impl SynchronousProxy for DeviceSynchronousProxy
Source§type Proxy = DeviceProxy
type Proxy = DeviceProxy
Source§type Protocol = DeviceMarker
type Protocol = DeviceMarker
Proxy
controls.