Skip to content

Commit f71f0fc

Browse files
committed
Merge branch 'feat/esp_netif_custom_impl' into 'master'
feat(esp_netif): Add support for esp_netif with custom TCP/IP stack Closes IDF-6375 See merge request espressif/esp-idf!31593
2 parents a110f09 + 921b2a6 commit f71f0fc

File tree

11 files changed

+725
-558
lines changed

11 files changed

+725
-558
lines changed

components/esp_netif/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,18 @@ menu "ESP NETIF Adapter"
1313
the timer expires. The IP lost timer is stopped if the station get the IP again before
1414
the timer expires.
1515

16+
config ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION
17+
bool "Use only ESP-NETIF headers"
18+
default n
19+
help
20+
No implementation of ESP-NETIF functions is provided.
21+
This option is used for adding a custom TCP/IP stack and defining related
22+
esp_netif functionality
23+
1624
choice ESP_NETIF_USE_TCPIP_STACK_LIB
1725
prompt "TCP/IP Stack Library"
1826
default ESP_NETIF_TCPIP_LWIP
27+
depends on !ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION
1928
help
2029
Choose the TCP/IP Stack to work, for example, LwIP, uIP, etc.
2130
config ESP_NETIF_TCPIP_LWIP

components/esp_netif/loopback/esp_netif_loopback.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -465,4 +465,23 @@ esp_err_t esp_netif_remove_ip6_address(esp_netif_t *esp_netif, const esp_ip6_add
465465
return ESP_ERR_NOT_SUPPORTED;
466466
}
467467

468+
int esp_netif_get_all_ip6(esp_netif_t *esp_netif, esp_ip6_addr_t if_ip6[])
469+
{
470+
return 0;
471+
}
472+
473+
esp_ip6_addr_type_t esp_netif_ip6_get_addr_type(esp_ip6_addr_t* ip6_addr)
474+
{
475+
return ESP_IP6_ADDR_IS_UNKNOWN;
476+
}
477+
478+
esp_err_t esp_netif_tcpip_exec(esp_netif_callback_fn fn, void*ctx)
479+
{
480+
return fn(ctx);
481+
}
482+
483+
esp_netif_t *esp_netif_get_handle_from_ifkey(const char *if_key)
484+
{
485+
return esp_netif_get_handle_from_ifkey_unsafe(if_key);
486+
}
468487
#endif /* CONFIG_ESP_NETIF_LOOPBACK */
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
idf_component_register(SRCS "esp_netif_test.c"
2-
REQUIRES test_utils
3-
INCLUDE_DIRS "."
4-
PRIV_INCLUDE_DIRS "$ENV{IDF_PATH}/components/esp_netif/private_include" "."
5-
PRIV_REQUIRES unity esp_netif nvs_flash esp_wifi)
1+
if(CONFIG_ESP_NETIF_TCPIP_LWIP)
2+
set(srcs_test_stack esp_netif_test_lwip.c)
3+
elseif(CONFIG_ESP_NETIF_LOOPBACK)
4+
set(srcs_test_stack esp_netif_test_loopback.c)
5+
endif()
6+
7+
idf_component_register(SRCS esp_netif_test.c ${srcs_test_stack}
8+
REQUIRES test_utils
9+
INCLUDE_DIRS "."
10+
PRIV_INCLUDE_DIRS "$ENV{IDF_PATH}/components/esp_netif/private_include" "."
11+
PRIV_REQUIRES unity esp_netif nvs_flash esp_wifi)

0 commit comments

Comments
 (0)