class Device
Defined at line 4593 of file fidling/gen/sdk/fidl/fuchsia.net.tun/fuchsia.net.tun/hlcpp/fuchsia/net/tun/cpp/fidl.h
Provides control over the created device.
This protocol encodes the underlying object's lifetime in both directions;
the underlying object is alive iff both ends of the protocol are open. That
is:
- Closing the client end causes the object to be destroyed.
- Observing a closure of the server end indicates the object no longer
exists.
Public Methods
void ~Device ()
void WriteFrame (::fuchsia::net::tun::Frame frame, WriteFrameCallback callback)
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` if `frame` is invalid.
* 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 to `WriteFrame` are
pending.
* error `ZX_ERR_SHOULD_WAIT` if `blocking` is set to `false` and there
are no buffers available to fulfill the request.
void ReadFrame (ReadFrameCallback callback)
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 to `ReadFrame` are
pending.
* error `ZX_ERR_SHOULD_WAIT` if `blocking` is set to `false` and there
are no frames to be read.
void GetSignals (GetSignalsCallback callback)
Retrieves signals eventpair.
- response `signals` an eventpair that is signalled with
`SIGNAL_READABLE` and `SIGNAL_WRITABLE` when read and write buffers are
available, respectively.
void AddPort (::fuchsia::net::tun::DevicePortConfig config, ::fidl::InterfaceRequest< ::fuchsia::net::tun::Port> port)
Creates a new port on this device.
+ request `config` new port configuration.
+ request `port` grants control over the port. Closed with an epitaph if
`config` is not valid.
void GetDevice (::fidl::InterfaceRequest< ::fuchsia::hardware::network::Device> device)
Connects to the underlying device endpoint.
+ request `device` device handle.
void DelegateRxLease (::fuchsia::hardware::network::DelegatedRxLease lease)
Delegates an rx lease through the tun device.
See documentation on [`fuchsia.hardware.network/DelegatedRxLease`] for
proper usage.