class TunPair

Defined at line 23 of file ../../src/connectivity/network/tun/network-tun/tun_pair.h

Implements `fuchsia.net.tun.DevicePair`.

`TunPair` uses `DeviceAdapter` to fulfill the `fuchsia.net.tun.DevicePair` protocol. All FIDL

requests are served over its own internally held async dispatcher.

Public Methods

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

Creates a new `TunPair` with `config`.

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

Defined at line 20 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

const BaseDeviceConfig & config ()

DeviceAdapterParent implementation:

Defined at line 36 of file ../../src/connectivity/network/tun/network-tun/tun_pair.h

void ~TunPair ()

Defined at line 67 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void OnTxAvail (DeviceAdapter * device)

Defined at line 187 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void OnRxAvail (DeviceAdapter * device)

Defined at line 201 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void RequestErrorUnbind ()

Defined at line 215 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void Bind (fidl::ServerEnd<fuchsia_net_tun::DevicePair> 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 90 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

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

Defined at line 97 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void RemovePort (RemovePortRequestView request, RemovePortCompleter::Sync & completer)

Defined at line 142 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void GetLeft (GetLeftRequestView request, GetLeftCompleter::Sync & _completer)

Defined at line 159 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void GetRight (GetRightRequestView request, GetRightCompleter::Sync & _completer)

Defined at line 166 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void GetLeftPort (GetLeftPortRequestView request, GetLeftPortCompleter::Sync & _completer)

Defined at line 173 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void GetRightPort (GetRightPortRequestView request, GetRightPortCompleter::Sync & _completer)

Defined at line 179 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc