esp-netif: Added API to get the underlying interface name

The interface name can be used in socket API, i.e. setsockopt(). The API esp_netif_get_netif_impl_name() shoudl be used to populate standard
interface structure struct ifreq.
This commit is contained in:
David Cermak
2020-04-23 14:13:56 +02:00
parent 06711c7c36
commit 8a45f074fc
4 changed files with 51 additions and 3 deletions

View File

@@ -402,6 +402,22 @@ esp_err_t esp_netif_set_old_ip_info(esp_netif_t *esp_netif, const esp_netif_ip_i
*/
int esp_netif_get_netif_impl_index(esp_netif_t *esp_netif);
/**
* @brief Get net interface name from network stack implementation
*
* @note This name could be used in `setsockopt()` to bind socket with appropriate interface
*
* @param[in] esp_netif Handle to esp-netif instance
* @param[out] name Interface name as specified in underlying TCP/IP stack. Note that the
* actual name will be copied to the specified buffer, which must be allocated to hold
* maximum interface name size (6 characters for lwIP)
*
* @return
* - ESP_OK
* - ESP_ERR_ESP_NETIF_INVALID_PARAMS
*/
esp_err_t esp_netif_get_netif_impl_name(esp_netif_t *esp_netif, char* name);
/**
* @}
*/