Chapter 2. API Reference
2.1.4 IP Network Layer
ESP-NETIF
The purpose of ESP-NETIF library is twofold:
• It provides an abstraction layer for the application on top of the TCP/IP stack. This will allow applications to
choose between IP stacks in the future.
• The APIs it provides are thread safe, even if the underlying TCP/IP stack APIs are not.
ESP-IDF currently implements ESP-NETIF for the lwIP TCP/IP stack only. However, the adapter itself is TCP/IP
implementation agnostic and different implementations are possible.
Some ESP-NETIF API functions are intended to be called by application code, for example to get/set interface IP
addresses, configure DHCP. Other functions are intended for internal ESP-IDF use by the network driver layer.
In many cases, applications do not need to call ESP-NETIF APIs directly as they are called from the default network
event handlers.
ESP-NETIF component is a successor of the tcpip_adapter, former network interface abstraction, which has become
deprecated since IDF v4.1. Please refer to the
to be ported to use the esp-netif API instead.
ESP-NETIF architecture
|
|
.............| init
.
+----------------------------------------+
.
.
--------+
+===========================+
|
| new/config
|
|
|
|---------------------------|
init
|
|
start |********|
stop
|
|
|
|---------------------------|
|
|
+-----|
|
| glue|----<---|
|
|
|
|
|---->---|
|
|
|
|
|....<...|
+-----|
|
|
|
(B)
|
|
--------+
+===========================+
communication
DRIVER
Data and event flow in the diagram
• ........ Initialization line from user code to ESP-NETIF and communication driver
• --<--->-- Data packets going from communication media to TCP/IP stack and back
• ******** Events aggregated in ESP-NETIF propagates to driver, user code and network stack
• | User settings and runtime configuration
ESP-NETIF interaction
Espressif Systems
TCP/IP Adapter Migration Guide
(A) USER CODE
settings
.
|
.
|
get/set
event handler
esp_netif_transmit
esp_netif_receive
esp_netif_free_rx_buffer |...<.....| packet buffer
(C)
ESP-NETIF
Submit Document Feedback
section in case existing applications
|
|
events
|
*
*
*
+-----------------------+
|
*
|
|...*.....| init
*
|
|****
|
|*********|
DHCP
|
|
|
|
|
|
+-----------------+
|--<------| netif_output
|
|
|-->------| netif_input
|
+ ----------------+
|
|
|
|
|
+-----------------------+
197
|
|
|
|
|
|
|
NETIF
|
|
|
|
|
|
|
|
|
|
|
(D)
|
NETWORK STACK
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?