class VmoStore
Defined at line 29 of file ../../src/connectivity/network/tun/network-tun/buffer.h
A data structure that stores keyed VMOs and allocates buffers.
`VmoStore` stores up to `kMaxVmos` VMOs keyed by an identifier bound to the range [0,
`kMaxVmos`). `VmoStore` can be used to allocate buffers backed by the VMOs it contains.
This class is used to fulfill the VMO registration mechanism used by
`fuchsia.hardware.network.driver`.
Public Methods
zx_status_t RegisterVmo (uint8_t id, zx::vmo vmo)
Registers and maps `vmo` identified by `id`.
`id` comes from a `NetworkDeviceInterface` and is part of the NetworkDevice contract.
Returns an error if the identifier is invalid or already in use, or the mapping fails.
Defined at line 21 of file ../../src/connectivity/network/tun/network-tun/buffer.cc
zx_status_t UnregisterVmo (uint8_t id)
Unregister a previously registered VMO with `id`, unmapping it from memory and releasing the
VMO handle.
Returns an error if the identifier is invalid or does not map to a registered VMO.
Defined at line 31 of file ../../src/connectivity/network/tun/network-tun/buffer.cc
void VmoStore ()
Defined at line 31 of file ../../src/connectivity/network/tun/network-tun/buffer.h
zx_status_t Copy (VmoStore & src_store, uint8_t src_id, size_t src_offset, VmoStore & dst_store, uint8_t dst_id, size_t dst_offset, size_t len)
Copies `len` bytes from `src_store`'s VMO with `src_id` at `src_offset` to `dst_store`'s VMO
with `dst_id` at `dst_offset`.
Equivalent to:
T data;
src_store.Read(src_id, src_offset, len, back_inserter(data));
dst_store.Write(dst_id, dst_offset, len, data.begin());
Defined at line 33 of file ../../src/connectivity/network/tun/network-tun/buffer.cc
void ~VmoStore ()
Defined at line 39 of file ../../src/connectivity/network/tun/network-tun/buffer.h
template <class T>
zx_status_t Read (uint8_t id, size_t offset, size_t len, T data)
Reads `len` bytes at `offset` from the VMO identified by `id` into `data`, which must be a
`uint8_t` iterator.
Returns an error if the specified region is invalid or `id` is not registered.
Defined at line 45 of file ../../src/connectivity/network/tun/network-tun/buffer.h
TxBuffer MakeTxBuffer (const fuchsia_hardware_network_driver::wire::TxBuffer & tx, bool get_meta)
Defined at line 53 of file ../../src/connectivity/network/tun/network-tun/buffer.cc
RxBuffer MakeRxSpaceBuffer (const fuchsia_hardware_network_driver::wire::RxSpaceBuffer & space)
Defined at line 58 of file ../../src/connectivity/network/tun/network-tun/buffer.cc
template <class T>
zx_status_t Write (uint8_t id, size_t offset, size_t len, T data)
Writes `len` bytes at `offset` into the VMO identified by `id` from `data`, which must be an
`uint8_t` iterator.
Returns an error if the specified region is invalid or `id` is not registered.
Defined at line 61 of file ../../src/connectivity/network/tun/network-tun/buffer.h
RxBuffer MakeEmptyRxBuffer ()
Defined at line 65 of file ../../src/connectivity/network/tun/network-tun/buffer.cc