Skip to content

Commit

Permalink
Merge branch 'feat/esp_netif_custom_impl' into 'master'
Browse files Browse the repository at this point in the history
feat(esp_netif): Add support for esp_netif with custom TCP/IP stack

Closes IDF-6375

See merge request espressif/esp-idf!31593
  • Loading branch information
david-cermak committed Aug 23, 2024
2 parents a110f09 + 921b2a6 commit f71f0fc
Show file tree
Hide file tree
Showing 11 changed files with 725 additions and 558 deletions.
9 changes: 9 additions & 0 deletions components/esp_netif/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ menu "ESP NETIF Adapter"
the timer expires. The IP lost timer is stopped if the station get the IP again before
the timer expires.

config ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION
bool "Use only ESP-NETIF headers"
default n
help
No implementation of ESP-NETIF functions is provided.
This option is used for adding a custom TCP/IP stack and defining related
esp_netif functionality

choice ESP_NETIF_USE_TCPIP_STACK_LIB
prompt "TCP/IP Stack Library"
default ESP_NETIF_TCPIP_LWIP
depends on !ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION
help
Choose the TCP/IP Stack to work, for example, LwIP, uIP, etc.
config ESP_NETIF_TCPIP_LWIP
Expand Down
21 changes: 20 additions & 1 deletion components/esp_netif/loopback/esp_netif_loopback.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -465,4 +465,23 @@ esp_err_t esp_netif_remove_ip6_address(esp_netif_t *esp_netif, const esp_ip6_add
return ESP_ERR_NOT_SUPPORTED;
}

int esp_netif_get_all_ip6(esp_netif_t *esp_netif, esp_ip6_addr_t if_ip6[])
{
return 0;
}

esp_ip6_addr_type_t esp_netif_ip6_get_addr_type(esp_ip6_addr_t* ip6_addr)
{
return ESP_IP6_ADDR_IS_UNKNOWN;
}

esp_err_t esp_netif_tcpip_exec(esp_netif_callback_fn fn, void*ctx)
{
return fn(ctx);
}

esp_netif_t *esp_netif_get_handle_from_ifkey(const char *if_key)
{
return esp_netif_get_handle_from_ifkey_unsafe(if_key);
}
#endif /* CONFIG_ESP_NETIF_LOOPBACK */
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
idf_component_register(SRCS "esp_netif_test.c"
REQUIRES test_utils
INCLUDE_DIRS "."
PRIV_INCLUDE_DIRS "$ENV{IDF_PATH}/components/esp_netif/private_include" "."
PRIV_REQUIRES unity esp_netif nvs_flash esp_wifi)
if(CONFIG_ESP_NETIF_TCPIP_LWIP)
set(srcs_test_stack esp_netif_test_lwip.c)
elseif(CONFIG_ESP_NETIF_LOOPBACK)
set(srcs_test_stack esp_netif_test_loopback.c)
endif()

idf_component_register(SRCS esp_netif_test.c ${srcs_test_stack}
REQUIRES test_utils
INCLUDE_DIRS "."
PRIV_INCLUDE_DIRS "$ENV{IDF_PATH}/components/esp_netif/private_include" "."
PRIV_REQUIRES unity esp_netif nvs_flash esp_wifi)
Loading

0 comments on commit f71f0fc

Please sign in to comment.