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
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,
) -> 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
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,
) -> QueryResponseFut<EventPair, DefaultFuchsiaResourceDialect>
pub fn get_signals( &self, ) -> QueryResponseFut<EventPair, DefaultFuchsiaResourceDialect>
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 Clone for DeviceProxy
impl Clone for DeviceProxy
Source§fn clone(&self) -> DeviceProxy
fn clone(&self) -> DeviceProxy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§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.Source§fn from_channel(inner: AsyncChannel) -> Self
fn from_channel(inner: AsyncChannel) -> Self
Source§fn into_channel(self) -> Result<AsyncChannel, Self>
fn into_channel(self) -> Result<AsyncChannel, Self>
Source§fn as_channel(&self) -> &AsyncChannel
fn as_channel(&self) -> &AsyncChannel
§fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
Auto Trait Implementations§
impl Freeze for DeviceProxy
impl !RefUnwindSafe for DeviceProxy
impl Send for DeviceProxy
impl Sync for DeviceProxy
impl Unpin for DeviceProxy
impl !UnwindSafe for DeviceProxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)