class NetworkDevice

Defined at line 36 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/network_device.h

This class is intended to make it easier to construct and work with a

fuchsia.hardware.network.device device (called netdev here) and its interfaces. The user should

instantiate an object of this class and provide an implementation of NetworkDevice::Callbacks to

handle the various calls that are made to it.

The actual network device is created when Initialize() is called. As part of the creation of the

device Callbacks::NetDevInit will be called and is a suitable place to perform any setup that

could fail and prevent the creation of the device by returning an error code. When the device

is destroyed Callbacks::NetDevRelease will be called which should be used to perform any cleanup.

Public Methods

void NetworkDevice (Callbacks * callbacks)

Defined at line 34 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_device.cc

void ~NetworkDevice ()

Defined at line 36 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_device.cc

zx_status_t Initialize (fidl::WireClient<fuchsia_driver_framework::Node> & parent, fdf_dispatcher_t * dispatcher, fdf::OutgoingDirectory & outgoing, const char * device_name)

Initialize the NetworkDevice. This should be called by the device driver when it's ready for

the NetworkDevice to start. The NetworkDeviceImpl service will be added to the |outgoing|

directory. A netdev child node named |device_name| will be added to |parent|. Requests will be

served on |dispatcher|. This MUST be called on a dispatcher that can safely make calls to

|parent| and |outgoing|. The |outgoing| object MUST be kept alive for the duration of the

NetworkDevice object's lifetime. It will be used again as part of the Remove call.

Defined at line 47 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_device.cc

bool Remove ()

Remove the NetworkDevice, this calls Remove on the network device child node controller. The

removal is not complete until NetDevRelease is called on the Callbacks interface. Returns true

if removal was initiated, false if removal is not needed because Initialize was never called or

the device was already removed. Note that multiple concurrent calls to Remove may all return

true, don't rely on it to determine if removal has been initiated. It only indicates that the

removal is completed.

Defined at line 87 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_device.cc

void NetworkDevice (const NetworkDevice & )

Defined at line 131 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/network_device.h

NetworkDevice & operator= (const NetworkDevice & )

Defined at line 132 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/network_device.h

void WaitUntilServerConnected ()

Wait until the server is connected to a client. Intended for use in testing.

Defined at line 133 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_device.cc

fdf::WireSharedClient<fuchsia_hardware_network_driver::NetworkDeviceIfc> & NetDevIfcClient ()

Access the NetworkDeviceIfc client that is created when NetworkDeviceImpl::Init is called by

the network-device driver. This client will not be valid until the NetDevInit callback has been

called on the Callbacks interface.

Defined at line 135 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_device.cc

void CompleteRx (Frame && frame)

Notify NetworkDevice of a single incoming RX frame. This method exists for convenience but the

driver should prefer to complete as many frames as possible in one call instead of making

multiple calls to this method. It is safe to complete a frame with a size of zero, such a frame

will be considered unfulfilled. An unfulfilled frame will not be passed up through the network

stack and its receive space can be made available to the device again. After this call the

device must not expect to be able to use the frame again.

Defined at line 139 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_device.cc

void CompleteRx (FrameContainer && frames)

Notify NetworkDevice of multiple incoming RX frames. This is the preferred way of receiving

frames as receiving multiple frames in one call is more efficient. It is safe to complete

frames with a size of zero, such frames will be considered unfulfilled. Unfulfilled frames will

not be passed up through the network stack and its receive space can be made available to the

device again. This allows the driver to indicate that individual frames in a FrameContainer do

not need to be received without having to remove them from the FrameContainer. After this call

the device must not expect to be able to use the frames again.

Defined at line 163 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_device.cc

void CompleteTx (cpp20::span<Frame> frames, zx_status_t status)

Notify NetworkDevice that TX frames have been completed. This can be either because they were

successfully received, indicated by a ZX_OK status, or failed somehow, indicated by anything

other than ZX_OK. All frames in the sequence will be completed with the same status, if the

driver has partially completed a transmission where some frames succeeded and some failed, the

driver will have to create separate spans and make multiple calls to this method. After this

call the device must not expect to be able to use the frames again.

Defined at line 201 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_device.cc

Records