class Buffer

Defined at line 106 of file ../../src/connectivity/network/tun/network-tun/buffer.h

A device buffer.

Device buffers can be created from VMO stores. They're used to store references to buffers

retrieved from a NetworkDeviceInterface, which point to data regions within a VMO.

`Buffer` can represent either a tx (application-filled data) buffer or an rx (empty space for

inbound data) buffer.

Public Methods

zx_status_t Read (std::vector<uint8_t> & vec)

Reads this buffer's data into `vec`.

Used to serve `fuchsia.net.tun/Device.ReadFrame`.

Returns an error if this buffer's definition does not map to valid data (see `VmoStore::Write`

for specific error codes).

Defined at line 73 of file ../../src/connectivity/network/tun/network-tun/buffer.cc

zx_status_t Write (const uint8_t * data, size_t count)

Writes `data` into this buffer.

If this `data` does not fit in this buffer, `ZX_ERR_OUT_OF_RANGE` is returned.

Returns an error if this buffer's definition does not map to valid data (see `VmoStore::Write`

for specific error codes).

Used to serve `fuchsia.net.tun/Device.WriteFrame`.

Defined at line 85 of file ../../src/connectivity/network/tun/network-tun/buffer.cc

zx_status_t Write (const fidl::VectorView<uint8_t> & data)

Defined at line 104 of file ../../src/connectivity/network/tun/network-tun/buffer.cc

void Buffer (Buffer && )

Defined at line 108 of file ../../src/connectivity/network/tun/network-tun/buffer.h

zx_status_t Write (const std::vector<uint8_t> & data)

Defined at line 108 of file ../../src/connectivity/network/tun/network-tun/buffer.cc

void Buffer (const Buffer & )

Defined at line 109 of file ../../src/connectivity/network/tun/network-tun/buffer.h

zx::result<size_t> CopyFrom (Buffer & other)

Copies data from `other` into this buffer, returning the number of bytes written on success.

Defined at line 112 of file ../../src/connectivity/network/tun/network-tun/buffer.cc

uint64_t length ()

Returns this buffer's length in bytes.

Defined at line 127 of file ../../src/connectivity/network/tun/network-tun/buffer.h

Protected Methods

void PushPart (const BufferPart & part)

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

void Buffer (VmoStore * vmo_store)

Defined at line 136 of file ../../src/connectivity/network/tun/network-tun/buffer.h

cpp20::span<BufferPart> parts ()

Defined at line 138 of file ../../src/connectivity/network/tun/network-tun/buffer.h

cpp20::span<const BufferPart> parts ()

Defined at line 139 of file ../../src/connectivity/network/tun/network-tun/buffer.h

Records