class NetworkDeviceClient
Defined at line 108 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.h
A client for `fuchsia.hardware.network/Device`.
Public Members
static const uint32_t kDefaultBufferLength
Public Methods
SessionConfig DefaultSessionConfig (const DeviceInfo & dev_info)
Creates a default session configuration with the given device information.
Defined at line 139 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
void NetworkDeviceClient (fidl::ClientEnd<netdev::Device> handle, async_dispatcher_t * dispatcher)
Creates a client that will bind to `handle` using `dispatcher`.
If `dispatcher` is `nullptr`, the default dispatcher for the current thread will be used.
All the `NetworkDeviceClient` callbacks are called on the dispatcher.
Defined at line 104 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
void ~NetworkDeviceClient ()
Defined at line 137 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
void SetRxCallback (RxCallback callback)
Sets the callback for received frames.
Defined at line 144 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.h
void SetErrorCallback (ErrorCallback callback)
Sets the callback that will be triggered when an open session encounters errors or the device
handle is closed.
Defined at line 148 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.h
void OpenSession (const std::string & name, OpenSessionCallback callback, SessionConfigFactory config_factory)
Opens a new session with `name` and invokes `callback` when done.
`config_factory` is called to create a `SessionConfig` from a `fuchsia.hardware.network/Info`,
which is used to define the buffer allocation and layout for the new session.
If the client already has a session running, `OpenSession` fails with `ZX_ERR_ALREADY_EXISTS`.
Defined at line 158 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
bool HasSession ()
Defined at line 182 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.h
const DeviceInfo & device_info ()
Defined at line 193 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.h
void AttachPort (netdev::wire::PortId port_id, std::vector<netdev::wire::FrameType> rx_frame_types, ErrorCallback callback)
Attaches a port to the current session.
Calls callback with the operation's result.
Defined at line 313 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
void DetachPort (netdev::wire::PortId port_id, ErrorCallback callback)
Detaches a port from the current session.
Calls callback with the operation's result.
Defined at line 340 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
void GetPortInfoWithMac (netdev::wire::PortId port_id, PortInfoWithMacCallback callback)
Gets information about the given port.
Ports may be freely queried without being attached.
Defined at line 364 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
void GetPorts (PortsCallback callback)
Gets all ports currently attached to the device.
Defined at line 459 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
zx_status_t KillSession ()
Kills the current session.
The error callback is called once the session is destroyed with the session epitaph.
Returns `ZX_ERR_BAD_STATE` if there's no open session.
Defined at line 545 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
zx_status_t Send (Buffer * buffer)
Attempts to send `buffer`.
If this buffer was received on the rx path, `Send` will attempt to allocate a buffer from the
transmit pool to replace this buffer before sending it.
`buffer` is transitioned to an invalid state on success.
Defined at line 833 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
zx::result<std::unique_ptr<NetworkDeviceClient::StatusWatchHandle>> WatchStatus (netdev::wire::PortId port_id, StatusCallback callback, uint32_t buffer)
Creates an asynchronous handler for status changes.
`callback` will be called for every status change on the device for as long as the returned
`StatusWatchHandle` is in scope.
`buffer` is the number of changes buffered by the network device, according to the
`fuchsia.hardware.network.Device` protocol.
Defined at line 562 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
Buffer AllocTx ()
Allocates a transmit buffer.
Takes a buffer from the pool of available transmit buffers. If there are no buffers available,
the returned `Buffer` instance will be invalid (`Buffer::is_valid` returns false).
Defined at line 900 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
void OnDeviceError (fidl::UnbindInfo info)
Defined at line 115 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc
void OnSessionError (fidl::UnbindInfo info)
Defined at line 124 of file ../../src/connectivity/lib/network-device/cpp/network_device_client.cc