class TunPair

Defined at line 31 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 44 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 193 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

void OnRxAvail (DeviceAdapter * device)

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

void RequestErrorUnbind ()

Defined at line 221 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 148 of file ../../src/connectivity/network/tun/network-tun/tun_pair.cc

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

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

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

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

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

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

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

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

Friends

class TunTest