Networking_GetInterfaces Function

Header: #include <applibs/networking.h>

Gets the list of network interfaces in an Azure Sphere device. If outNetworkInterfaces is too small to hold all network interfaces in the system, this function fills the array and returns the number of array elements. The number of interfaces in the system will not change within a boot cycle.

ssize_t Networking_GetInterfaces(Networking_NetworkInterface *outNetworkInterfacesArray, size_t networkInterfacesArrayCount);

Parameters

  • outNetworkInterfacesArray A pointer to an array of Networking_NetworkInterface structs to fill with network interface properties. The caller must allocate memory for the array after calling Networking_GetInterfacesCount to retrieve the number of interfaces on the device.

  • networkInterfacesArrayCount The number of elements outNetworkInterfacesArray can hold. The array should have one element for each network interface on the device.

Errors

Returns -1 if an error is encountered and sets errno to the error value.

  • EFAULT: the outNetworkInterfacesArray parameter is NULL.

  • ERANGE: the networkInterfacesArrayCount parmaeter is 0.

  • EAGAIN: the networking stack isn't ready yet.

Any other errno may also be specified; such errors aren't deterministic and the same behavior might not be retained through system updates.

Return value

Returns the number of network interfaces added to the outNetworkInterfaces array. Otherwise -1 for failure, in which case errno is set to the error value.

Concepts and samples