class TunDevice

Defined at line 34 of file ../../src/connectivity/network/tun/network-tun/tun_device.h

Implements `fuchsia.net.tun.Device`.

`TunDevice` uses `DeviceAdapter` to fulfill the `fuchsia.net.tun.Device` protocol. All FIDL

requests are served over its own internally held async dispatcher.

Public Members

static const size_t kMaxPendingOps

Public Methods

zx::result<std::unique_ptr<TunDevice>> Create (const DeviceInterfaceDispatchers & dispatchers, fdf::UnownedUnsynchronizedDispatcher && netdev_dispatcher, fit::callback<void (TunDevice *)> teardown, DeviceConfig && config)

Creates a new `TunDevice` with `config`.

`teardown` is called when all the bound client channels are closed.

Defined at line 55 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

const BaseDeviceConfig & config ()

DeviceAdapterParent implementation:

Defined at line 58 of file ../../src/connectivity/network/tun/network-tun/tun_device.h

void ~TunDevice ()

Defined at line 88 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void WriteFrame (WriteFrameRequestView request, WriteFrameCompleter::Sync & completer)

fuchsia.net.tun.Device implementation:

Defined at line 256 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void ReadFrame (ReadFrameCompleter::Sync & completer)

Defined at line 300 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void GetSignals (GetSignalsCompleter::Sync & completer)

Defined at line 309 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void AddPort (AddPortRequestView request, AddPortCompleter::Sync & _completer)

Defined at line 315 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void GetDevice (GetDeviceRequestView request, GetDeviceCompleter::Sync & _completer)

Defined at line 342 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void DelegateRxLease (DelegateRxLeaseRequestView request, DelegateRxLeaseCompleter::Sync & _completer)

Defined at line 349 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void OnTxAvail (DeviceAdapter * device)

Defined at line 360 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void OnRxAvail (DeviceAdapter * device)

Defined at line 365 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void RequestErrorUnbind ()

Defined at line 370 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

void Bind (fidl::ServerEnd<fuchsia_net_tun::Device> req)

Binds `req` to this device.

Requests are served over this device's owned loop.

NOTE: at this moment only one binding is supported, if the device is already bound the previous

channel is closed.

Defined at line 102 of file ../../src/connectivity/network/tun/network-tun/tun_device.cc

Protected Methods

const std::unique_ptr<DeviceAdapter> & adapter ()

Defined at line 71 of file ../../src/connectivity/network/tun/network-tun/tun_device.h

Friends

class TunTest