Chapter 2. API Reference
esp_err_t my_driver_netif_set_default_handlers(my_netif_driver_t *driver, esp_
,→netif_t * esp_netif)
{
driver_set_event_handler(driver->driver_impl, esp_netif_action_start, MY_DRV_
,→EVENT_START, esp_netif);
driver_set_event_handler(driver->driver_impl, esp_netif_action_stop, MY_DRV_
,→EVENT_STOP, esp_netif);
return ESP_OK;
}
Network stack connection The packet data path functions for transmitting and freeing the rx buffer (defined in
the I/O driver) are called from the esp-netif, specifically from its TCP/IP stack connecting layer. The following API
reference outlines these network stack interaction with the esp-netif.
Header File
• components/esp_netif/include/esp_netif_net_stack.h
Functions
esp_netif_t *esp_netif_get_handle_from_netif_impl(void *dev)
Returns esp-netif handle.
Return handle to related esp-netif instance
Parameters
• [in] dev: opaque ptr to network interface of specific TCP/IP stack
void *esp_netif_get_netif_impl(esp_netif_t *esp_netif)
Returns network stack specific implementation handle (if supported)
Note that it is not supported to acquire PPP netif impl pointer and this function will return NULL for esp_netif
instances configured to PPP mode
Return handle to related network stack netif handle
Parameters
• [in] esp_netif: Handle to esp-netif instance
esp_err_t esp_netif_transmit(esp_netif_t *esp_netif, void *data, size_t len)
Outputs packets from the TCP/IP stack to the media to be transmitted.
This function gets called from network stack to output packets to IO driver.
Return ESP_OK on success, an error passed from the I/O driver otherwise
Parameters
• [in] esp_netif: Handle to esp-netif instance
• [in] data: Data to be transmitted
• [in] len: Length of the data frame
esp_err_t esp_netif_transmit_wrap(esp_netif_t *esp_netif, void *data, size_t len, void
*netstack_buf)
Outputs packets from the TCP/IP stack to the media to be transmitted.
This function gets called from network stack to output packets to IO driver.
Return ESP_OK on success, an error passed from the I/O driver otherwise
Parameters
• [in] esp_netif: Handle to esp-netif instance
• [in] data: Data to be transmitted
• [in] len: Length of the data frame
• [in] netstack_buf: net stack buffer
void esp_netif_free_rx_buffer(void *esp_netif, void *buffer)
Free the rx buffer allocated by the media driver.
Espressif Systems 213
Submit Document Feedback
Release v4.4