class NetworkPort
Defined at line 30 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/network_port.h
A network port corresponds to a network interface. A network device can provide multiple network
ports. Such as a NIC with multiple RJ45 ports or in this case a WLAN device supporting multiple
interfaces using a single device.
The user should instantiate an object of this class and provide an implementation of
NetworkPort::Callbacks to handle the various calls that are made to it. An implementation can
choose to either inherit from NetworkPort (and optionally NetworkPort::Callbacks at the same
time) or create a standalone object.
A network port is created and registered with the network device when Init is called. The port
is removed when the destructor of this class is called, i.e. when the object is destroyed.
Public Methods
void NetworkPort (fdf::WireSharedClient<fuchsia_hardware_network_driver::NetworkDeviceIfc> && netdev_ifc, Callbacks & iface, uint8_t port_id)
Defined at line 14 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void ~NetworkPort ()
Defined at line 19 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void Init (Role role, fdf_dispatcher_t * dispatcher, fit::callback<void (zx_status_t)> && on_complete)
Must be called to make the port operational. If this fails the port object is no longer valid
and no further operations on the port are valid. Initialization is asynchronous and the result
will be reported through |on_complete|. The port is not valid for use until |on_complete| has
been called. In case of an error |on_complete| may (but is not guaranteed to) be called inline
from this function, be careful about acquiring locks during error handling in |on_complete| if
those locks are already held when calling Init. On success |on_complete| is always called
asynchronously. The |dispatcher| must stay alive and running until the port is removed, either
through |RemovePort|, object destruction, or |Callbacks::PortRemoved| being called. Otherwise
removal of the port could deadlock.
Defined at line 27 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
uint8_t PortId ()
Defined at line 92 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/network_port.h
void RemovePort (fit::callback<void (zx_status_t)> && on_complete)
Remove the port. |on_complete| will be used to report the result asynchronously. After calling
RemovePort no further operations on the port are valid. If the port was successfully
initialized by a call to Init it must be removed by a call to RemovePort. If Init has been
called it's not safe to destroy the port until RemovePort has been called and completion has
been signaled via a call to |on_complete|. It's safe to destroy the port even if |on_complete|
reports an error.
Defined at line 118 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void SetPortOnline (bool online)
Defined at line 216 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
bool IsOnline ()
Defined at line 238 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void GetInfo (fdf::Arena & arena, GetInfoCompleter::Sync & completer)
NetworkPortProtocol implementation
Defined at line 243 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void GetStatus (fdf::Arena & arena, GetStatusCompleter::Sync & completer)
Defined at line 269 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void SetActive (fuchsia_hardware_network_driver::wire::NetworkPortSetActiveRequest * request, fdf::Arena & arena, SetActiveCompleter::Sync & completer)
Defined at line 277 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void GetMac (fdf::Arena & arena, GetMacCompleter::Sync & completer)
Defined at line 281 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void Removed (fdf::Arena & arena, RemovedCompleter::Sync & completer)
Defined at line 311 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void GetAddress (fdf::Arena & arena, GetAddressCompleter::Sync & completer)
MacAddrProtocol implementation
Defined at line 319 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void GetFeatures (fdf::Arena & arena, GetFeaturesCompleter::Sync & completer)
Defined at line 325 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
void SetMode (fuchsia_hardware_network_driver::wire::MacAddrSetModeRequest * request, fdf::Arena & arena, SetModeCompleter::Sync & completer)
Defined at line 331 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/network_port.cc
Enumerations
enum Role
| Name | Value |
|---|---|
| Client | 0 |
| Ap | 1 |
Defined at line 65 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/network_port.h