Merge branch 'bugfix/esp_netif_clean_deps_lwip' into 'master'

esp-netif/lw-ip: Make dependencies one-directional

Closes IDF-4459, IDF-4460, IDF-1099, and IDFGH-6287

See merge request espressif/esp-idf!18084
This commit is contained in:
David Čermák
2022-07-21 20:18:05 +08:00
72 changed files with 640 additions and 1439 deletions

View File

@@ -678,8 +678,8 @@ endif()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}" INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}" PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES esp_timer REQUIRES esp_timer esp_wifi
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy mbedtls driver PRIV_REQUIRES nvs_flash soc esp_pm esp_phy mbedtls driver vfs
LDFRAGMENTS "linker.lf") LDFRAGMENTS "linker.lf")
if(CONFIG_BT_ENABLED) if(CONFIG_BT_ENABLED)

View File

@@ -1,4 +1,4 @@
idf_component_register(SRC_DIRS . param_test touch_sensor_test dac_dma_test idf_component_register(SRC_DIRS . param_test touch_sensor_test dac_dma_test
PRIV_INCLUDE_DIRS include param_test/include touch_sensor_test/include PRIV_INCLUDE_DIRS include param_test/include touch_sensor_test/include
PRIV_REQUIRES cmock test_utils driver nvs_flash esp_serial_slave_link PRIV_REQUIRES cmock test_utils driver nvs_flash esp_serial_slave_link
esp_timer esp_adc) esp_timer esp_adc esp_event esp_wifi)

View File

@@ -560,6 +560,9 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# endif # endif
# ifdef ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED # ifdef ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED
ERR_TBL_IT(ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED), /* 20492 0x500c */ ERR_TBL_IT(ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED), /* 20492 0x500c */
# endif
# ifdef ESP_ERR_ESP_NETIF_DHCPS_START_FAILED
ERR_TBL_IT(ESP_ERR_ESP_NETIF_DHCPS_START_FAILED), /* 20493 0x500d */
# endif # endif
// components/esp_common/include/esp_err.h // components/esp_common/include/esp_err.h
# ifdef ESP_ERR_FLASH_BASE # ifdef ESP_ERR_FLASH_BASE

View File

@@ -16,7 +16,6 @@ if(CONFIG_ETH_ENABLED)
# esp_netif related # esp_netif related
if(esp_netif IN_LIST components_to_build) if(esp_netif IN_LIST components_to_build)
list(APPEND srcs "src/esp_eth_netif_glue.c") list(APPEND srcs "src/esp_eth_netif_glue.c")
list(APPEND priv_requires esp_netif esp_pm)
endif() endif()
endif() endif()
@@ -54,6 +53,9 @@ idf_component_register(SRCS "${srcs}"
REQUIRES esp_event # For using "ESP_EVENT_DECLARE_BASE" in header file REQUIRES esp_event # For using "ESP_EVENT_DECLARE_BASE" in header file
PRIV_REQUIRES ${priv_requires}) PRIV_REQUIRES ${priv_requires})
if(CONFIG_ETH_USE_SPI_ETHERNET) if(CONFIG_ETH_ENABLED)
idf_component_optional_requires(PUBLIC driver) if(CONFIG_ETH_USE_SPI_ETHERNET)
idf_component_optional_requires(PUBLIC driver)
endif()
idf_component_optional_requires(PRIVATE esp_netif esp_pm)
endif() endif()

View File

@@ -7,6 +7,7 @@
#include "esp_netif.h" #include "esp_netif.h"
#include "esp_eth_driver.h" #include "esp_eth_driver.h"
#include "esp_eth_netif_glue.h" #include "esp_eth_netif_glue.h"
#include "esp_netif_net_stack.h"
#include "esp_event.h" #include "esp_event.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_check.h" #include "esp_check.h"
@@ -77,7 +78,10 @@ static void eth_action_start(void *handler_args, esp_event_base_t base, int32_t
esp_eth_netif_glue_t *netif_glue = handler_args; esp_eth_netif_glue_t *netif_glue = handler_args;
ESP_LOGD(TAG, "eth_action_start: %p, %p, %d, %p, %p", netif_glue, base, event_id, event_data, *(esp_eth_handle_t *)event_data); ESP_LOGD(TAG, "eth_action_start: %p, %p, %d, %p, %p", netif_glue, base, event_id, event_data, *(esp_eth_handle_t *)event_data);
if (netif_glue->eth_driver == eth_handle) { if (netif_glue->eth_driver == eth_handle) {
eth_speed_t speed;
esp_eth_ioctl(eth_handle, ETH_CMD_G_SPEED, &speed);
esp_netif_action_start(netif_glue->base.netif, base, event_id, event_data); esp_netif_action_start(netif_glue->base.netif, base, event_id, event_data);
esp_netif_set_link_speed(netif_glue->base.netif, speed == ETH_SPEED_100M ? 100000000 : 10000000);
} }
} }

View File

@@ -1,4 +1,4 @@
idf_component_register(SRC_DIRS . idf_component_register(SRC_DIRS .
PRIV_INCLUDE_DIRS . PRIV_INCLUDE_DIRS .
PRIV_REQUIRES cmock test_utils esp_eth esp_http_client PRIV_REQUIRES cmock test_utils esp_eth esp_http_client esp_netif
EMBED_TXTFILES dl_espressif_com_root_cert.pem) EMBED_TXTFILES dl_espressif_com_root_cert.pem)

View File

@@ -1,4 +1,4 @@
idf_component_register(SRCS "esp_eth_test.c" idf_component_register(SRCS "esp_eth_test.c"
INCLUDE_DIRS "." INCLUDE_DIRS "."
PRIV_INCLUDE_DIRS "." PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES unity esp_eth) PRIV_REQUIRES unity esp_eth esp_netif)

View File

@@ -11,12 +11,7 @@ if(${target} STREQUAL "linux")
# Temporary fix until esp_system is available for linux, too # Temporary fix until esp_system is available for linux, too
list(APPEND priv_include_dirs "$ENV{IDF_PATH}/tools/mocks/esp_system/include") list(APPEND priv_include_dirs "$ENV{IDF_PATH}/tools/mocks/esp_system/include")
else() else()
list(APPEND requires "esp_netif") list(APPEND priv_requires esp_timer)
if(${target} STREQUAL "esp32")
list(APPEND priv_requires esp_eth esp_timer)
else()
list(APPEND priv_requires esp_timer)
endif()
endif() endif()
idf_component_register(SRCS ${srcs} idf_component_register(SRCS ${srcs}

View File

@@ -5,5 +5,5 @@ idf_component_register(SRCS "esp_http_client.c"
INCLUDE_DIRS "include" INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS "lib/include" PRIV_INCLUDE_DIRS "lib/include"
# lwip is a public requirement because esp_http_client.h includes sys/socket.h # lwip is a public requirement because esp_http_client.h includes sys/socket.h
REQUIRES http_parser lwip REQUIRES lwip
PRIV_REQUIRES tcp_transport) PRIV_REQUIRES tcp_transport http_parser)

View File

@@ -10,7 +10,7 @@
#include "esp_system.h" #include "esp_system.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_check.h" #include "esp_check.h"
#include "http_parser.h"
#include "http_header.h" #include "http_header.h"
#include "esp_transport.h" #include "esp_transport.h"
#include "esp_transport_tcp.h" #include "esp_transport_tcp.h"

View File

@@ -8,7 +8,6 @@
#define _ESP_HTTP_CLIENT_H #define _ESP_HTTP_CLIENT_H
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "http_parser.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_err.h" #include "esp_err.h"
#include <sys/socket.h> #include <sys/socket.h>

View File

@@ -9,7 +9,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include "esp_netif.h"
#include "lwip/sockets.h" #include "lwip/sockets.h"
#include "esp_rom_md5.h" #include "esp_rom_md5.h"
#include "esp_tls_crypto.h" #include "esp_tls_crypto.h"

View File

@@ -12,7 +12,9 @@ set(srcs
"esp_netif_defaults.c" "esp_netif_defaults.c"
"lwip/esp_netif_lwip.c" "lwip/esp_netif_lwip.c"
"lwip/esp_netif_lwip_defaults.c" "lwip/esp_netif_lwip_defaults.c"
"lwip/esp_netif_sta_list.c") "lwip/netif/wlanif.c"
"lwip/netif/ethernetif.c"
"lwip/netif/esp_pbuf_ref.c" )
set(include_dirs "include") set(include_dirs "include")
set(priv_include_dirs "lwip" "private_include") set(priv_include_dirs "lwip" "private_include")
@@ -45,9 +47,10 @@ endif()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}" INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}" PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES lwip) REQUIRES esp_event
PRIV_REQUIRES lwip
LDFRAGMENTS linker.lf)
if(CONFIG_ESP_NETIF_L2_TAP OR CONFIG_ESP_NETIF_BRIDGE_EN) if(CONFIG_ESP_NETIF_L2_TAP OR CONFIG_ESP_NETIF_BRIDGE_EN)
idf_component_optional_requires(PRIVATE esp_eth) idf_component_optional_requires(PRIVATE esp_eth vfs)
endif() endif()

View File

@@ -5,7 +5,7 @@
*/ */
#include "esp_netif.h" #include "esp_netif.h"
#include "esp_wifi_default.h" #include "lwip/esp_netif_net_stack.h"
// //
// Purpose of this module is to provide // Purpose of this module is to provide
@@ -14,13 +14,18 @@
// //
// //
// Default configuration of common interfaces, such as STA, AP, ETH // Default configuration of common interfaces, such as STA, AP, ETH
// //
const esp_netif_inherent_config_t _g_esp_netif_inherent_sta_config = ESP_NETIF_INHERENT_DEFAULT_WIFI_STA(); const esp_netif_inherent_config_t _g_esp_netif_inherent_sta_config = ESP_NETIF_INHERENT_DEFAULT_WIFI_STA();
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT #ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
const esp_netif_ip_info_t _g_esp_netif_soft_ap_ip = {
.ip = { .addr = ESP_IP4TOADDR( 192, 168, 4, 1) },
.gw = { .addr = ESP_IP4TOADDR( 192, 168, 4, 1) },
.netmask = { .addr = ESP_IP4TOADDR( 255, 255, 255, 0) },
};
const esp_netif_inherent_config_t _g_esp_netif_inherent_ap_config = ESP_NETIF_INHERENT_DEFAULT_WIFI_AP(); const esp_netif_inherent_config_t _g_esp_netif_inherent_ap_config = ESP_NETIF_INHERENT_DEFAULT_WIFI_AP();
#endif #endif
@@ -29,11 +34,3 @@ const esp_netif_inherent_config_t _g_esp_netif_inherent_eth_config = ESP_NETIF_I
const esp_netif_inherent_config_t _g_esp_netif_inherent_ppp_config = ESP_NETIF_INHERENT_DEFAULT_PPP(); const esp_netif_inherent_config_t _g_esp_netif_inherent_ppp_config = ESP_NETIF_INHERENT_DEFAULT_PPP();
const esp_netif_inherent_config_t _g_esp_netif_inherent_slip_config = ESP_NETIF_INHERENT_DEFAULT_SLIP(); const esp_netif_inherent_config_t _g_esp_netif_inherent_slip_config = ESP_NETIF_INHERENT_DEFAULT_SLIP();
const esp_netif_inherent_config_t _g_esp_netif_inherent_openthread_config = ESP_NETIF_INHERENT_DEFAULT_OPENTHREAD();
const esp_netif_ip_info_t _g_esp_netif_soft_ap_ip = {
.ip = { .addr = ESP_IP4TOADDR( 192, 168, 4, 1) },
.gw = { .addr = ESP_IP4TOADDR( 192, 168, 4, 1) },
.netmask = { .addr = ESP_IP4TOADDR( 255, 255, 255, 0) },
};

View File

@@ -9,7 +9,6 @@
#include <stdint.h> #include <stdint.h>
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_wifi_types.h"
#include "esp_netif_ip_addr.h" #include "esp_netif_ip_addr.h"
#include "esp_netif_types.h" #include "esp_netif_types.h"
#include "esp_netif_defaults.h" #include "esp_netif_defaults.h"
@@ -616,6 +615,19 @@ esp_err_t esp_netif_dhcps_start(esp_netif_t *esp_netif);
*/ */
esp_err_t esp_netif_dhcps_stop(esp_netif_t *esp_netif); esp_err_t esp_netif_dhcps_stop(esp_netif_t *esp_netif);
/**
* @brief Populate IP addresses of clients connected to DHCP server listed by their MAC addresses
*
* @param[in] esp_netif Handle to esp-netif instance
* @param[in] num Number of clients with specified MAC addresses in the array of pairs
* @param[in,out] mac_ip_pair Array of pairs of MAC and IP addresses (MAC are inputs, IP outputs)
* @return
* - ESP_OK on success
* - ESP_ERR_ESP_NETIF_INVALID_PARAMS on invalid params
* - ESP_ERR_NOT_SUPPORTED if DHCP server not enabled
*/
esp_err_t esp_netif_dhcps_get_clients_by_mac(esp_netif_t *esp_netif, int num, esp_netif_pair_mac_ip_t *mac_ip_pair);
/** /**
* @} * @}
*/ */

View File

@@ -71,18 +71,6 @@ extern "C" {
.bridge_info = NULL \ .bridge_info = NULL \
}; };
#define ESP_NETIF_INHERENT_DEFAULT_OPENTHREAD() \
{ \
.flags = 0, \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(mac) \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(ip_info) \
.get_ip_event = 0, \
.lost_ip_event = 0, \
.if_key = "OT_DEF", \
.if_desc = "openthread", \
.route_prio = 15, \
.bridge_info = NULL \
};
#define ESP_NETIF_INHERENT_DEFAULT_SLIP() \ #define ESP_NETIF_INHERENT_DEFAULT_SLIP() \
{ \ { \
@@ -199,7 +187,6 @@ extern "C" {
#endif #endif
#define ESP_NETIF_NETSTACK_DEFAULT_PPP _g_esp_netif_netstack_default_ppp #define ESP_NETIF_NETSTACK_DEFAULT_PPP _g_esp_netif_netstack_default_ppp
#define ESP_NETIF_NETSTACK_DEFAULT_SLIP _g_esp_netif_netstack_default_slip #define ESP_NETIF_NETSTACK_DEFAULT_SLIP _g_esp_netif_netstack_default_slip
#define ESP_NETIF_NETSTACK_DEFAULT_OPENTHREAD _g_esp_netif_netstack_default_openthread
// //
// Include default network stacks configs // Include default network stacks configs
@@ -233,27 +220,6 @@ extern const esp_netif_inherent_config_t _g_esp_netif_inherent_slip_config;
extern const esp_netif_ip_info_t _g_esp_netif_soft_ap_ip; extern const esp_netif_ip_info_t _g_esp_netif_soft_ap_ip;
#endif #endif
#ifdef CONFIG_OPENTHREAD_ENABLED
/**
* @brief Default configuration reference of SLIP client
*/
#define ESP_NETIF_DEFAULT_OPENTHREAD() \
{ \
.base = ESP_NETIF_BASE_DEFAULT_OPENTHREAD, \
.driver = NULL, \
.stack = ESP_NETIF_NETSTACK_DEFAULT_OPENTHREAD, \
}
/**
* @brief Default base config (esp-netif inherent) of openthread interface
*/
#define ESP_NETIF_BASE_DEFAULT_OPENTHREAD &_g_esp_netif_inherent_openthread_config
extern const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_openthread;
extern const esp_netif_inherent_config_t _g_esp_netif_inherent_openthread_config;
#endif // CONFIG_OPENTHREAD_ENABLED
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -40,6 +40,14 @@ esp_netif_t* esp_netif_get_handle_from_netif_impl(void *dev);
*/ */
void* esp_netif_get_netif_impl(esp_netif_t *esp_netif); void* esp_netif_get_netif_impl(esp_netif_t *esp_netif);
/**
* @brief Set link-speed for the specified network interface
* @param[in] esp_netif Handle to esp-netif instance
* @param[in] speed Link speed in bit/s
* @return ESP_OK on success
*/
esp_err_t esp_netif_set_link_speed(esp_netif_t *esp_netif, uint32_t speed);
/** /**
* @} * @}
*/ */

View File

@@ -33,6 +33,8 @@ extern "C" {
#define ESP_ERR_ESP_NETIF_DNS_NOT_CONFIGURED ESP_ERR_ESP_NETIF_BASE + 0x0A #define ESP_ERR_ESP_NETIF_DNS_NOT_CONFIGURED ESP_ERR_ESP_NETIF_BASE + 0x0A
#define ESP_ERR_ESP_NETIF_MLD6_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0B #define ESP_ERR_ESP_NETIF_MLD6_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0B
#define ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0C #define ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0C
#define ESP_ERR_ESP_NETIF_DHCPS_START_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0D
/** /**
* @brief Definition of ESP-NETIF bridge controll * @brief Definition of ESP-NETIF bridge controll
@@ -245,6 +247,14 @@ struct esp_netif_config {
const esp_netif_netstack_config_t *stack; /*!< stack config */ const esp_netif_netstack_config_t *stack; /*!< stack config */
}; };
/**
* @brief DHCP client's addr info (pair of MAC and IP address)
*/
typedef struct {
uint8_t mac[6]; /**< Clients MAC address */
esp_ip4_addr_t ip; /**< Clients IP address */
} esp_netif_pair_mac_ip_t;
/** /**
* @brief ESP-NETIF Receive function type * @brief ESP-NETIF Receive function type
*/ */

View File

@@ -0,0 +1,82 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "esp_netif.h"
#include "lwip/netif.h"
#include "esp_netif_ppp.h"
#include "esp_netif_slip.h"
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
typedef err_t (*init_fn_t)(struct netif*);
typedef void (*input_fn_t)(void *netif, void *buffer, size_t len, void *eb);
struct esp_netif_netstack_lwip_vanilla_config {
init_fn_t init_fn;
input_fn_t input_fn;
};
struct esp_netif_netstack_lwip_ppp_config {
input_fn_t input_fn;
esp_netif_ppp_config_t ppp_events;
};
struct esp_netif_netstack_lwip_slip_config {
init_fn_t init_fn;
input_fn_t input_fn;
esp_netif_slip_config_t slip_config;
};
// LWIP netif specific network stack configuration
struct esp_netif_netstack_config {
union {
struct esp_netif_netstack_lwip_vanilla_config lwip;
struct esp_netif_netstack_lwip_ppp_config lwip_ppp;
};
};
/**
* @brief LWIP's network stack init function for Ethernet
* @param netif LWIP's network interface handle
* @return ERR_OK on success
*/
err_t ethernetif_init(struct netif *netif);
/**
* @brief LWIP's network stack input packet function for Ethernet
* @param h LWIP's network interface handle
* @param buffer Input buffer pointer
* @param len Input buffer size
* @param l2_buff External buffer pointer (to be passed to custom input-buffer free)
*/
void ethernetif_input(void *h, void *buffer, size_t len, void *l2_buff);
/**
* @brief LWIP's network stack init function for WiFi (AP)
* @param netif LWIP's network interface handle
* @return ERR_OK on success
*/
err_t wlanif_init_ap(struct netif *netif);
/**
* @brief LWIP's network stack init function for WiFi (Station)
* @param netif LWIP's network interface handle
* @return ERR_OK on success
*/
err_t wlanif_init_sta(struct netif *netif);
/**
* @brief LWIP's network stack input packet function for WiFi (both STA/AP)
* @param h LWIP's network interface handle
* @param buffer Input buffer pointer
* @param len Input buffer size
* @param l2_buff External buffer pointer (to be passed to custom input-buffer free)
*/
void wlanif_input(void *h, void *buffer, size_t len, void* l2_buff);
#endif // CONFIG_ESP_NETIF_TCPIP_LWIP

View File

@@ -7,8 +7,7 @@
* @file esp_pbuf reference interface file * @file esp_pbuf reference interface file
*/ */
#ifndef __LWIP_ESP_PBUF_REF_H__ #pragma once
#define __LWIP_ESP_PBUF_REF_H__
#include <stddef.h> #include <stddef.h>
#include "lwip/pbuf.h" #include "lwip/pbuf.h"
@@ -28,5 +27,3 @@ struct pbuf* esp_pbuf_allocate(esp_netif_t *esp_netif, void *buffer, size_t len,
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif //__LWIP_ESP_PBUF_REF_H__

View File

@@ -0,0 +1,13 @@
[mapping:esp_netif]
archive: libesp_netif.a
entries:
if LWIP_IRAM_OPTIMIZATION = y:
ethernetif:ethernet_low_level_output (noflash_text)
ethernetif:ethernetif_input (noflash_text)
wlanif:low_level_output (noflash_text)
wlanif:wlanif_input (noflash_text)
esp_netif_lwip:esp_netif_transmit_wrap (noflash_text)
esp_netif_lwip:esp_netif_free_rx_buffer (noflash_text)
esp_netif_lwip:esp_netif_receive (noflash_text)
esp_pbuf_ref:esp_pbuf_allocate (noflash_text)
esp_pbuf_ref:esp_pbuf_free (noflash_text)

View File

@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <string.h> #include <string.h>
@@ -18,7 +10,6 @@
#include "esp_netif.h" #include "esp_netif.h"
#include "esp_netif_private.h" #include "esp_netif_private.h"
#include "esp_netif_sta_list.h"
#if CONFIG_ESP_NETIF_LOOPBACK #if CONFIG_ESP_NETIF_LOOPBACK
@@ -398,11 +389,6 @@ esp_err_t esp_netif_get_dns_info(esp_netif_t *esp_netif, esp_netif_dns_type_t ty
return ESP_ERR_NOT_SUPPORTED; return ESP_ERR_NOT_SUPPORTED;
} }
esp_err_t esp_netif_get_sta_list(const wifi_sta_list_t *wifi_sta_list, esp_netif_sta_list_t *netif_sta_list)
{
return ESP_ERR_NOT_SUPPORTED;
}
esp_err_t esp_netif_create_ip6_linklocal(esp_netif_t *esp_netif) esp_err_t esp_netif_create_ip6_linklocal(esp_netif_t *esp_netif)
{ {
return ESP_ERR_NOT_SUPPORTED; return ESP_ERR_NOT_SUPPORTED;

View File

@@ -10,6 +10,8 @@
#include "esp_check.h" #include "esp_check.h"
#include "esp_netif_lwip_internal.h" #include "esp_netif_lwip_internal.h"
#include "lwip/esp_netif_net_stack.h"
#include "esp_netif.h" #include "esp_netif.h"
#include "esp_netif_private.h" #include "esp_netif_private.h"
@@ -23,6 +25,7 @@
#include "lwip/ip6_addr.h" #include "lwip/ip6_addr.h"
#include "lwip/mld6.h" #include "lwip/mld6.h"
#include "lwip/nd6.h" #include "lwip/nd6.h"
#include "lwip/snmp.h"
#include "lwip/priv/tcpip_priv.h" #include "lwip/priv/tcpip_priv.h"
#include "lwip/netif.h" #include "lwip/netif.h"
#include "lwip/etharp.h" #include "lwip/etharp.h"
@@ -943,7 +946,11 @@ static esp_err_t esp_netif_start_api(esp_netif_api_msg_t *msg)
memcpy(&lwip_netmask, &default_ip->netmask, sizeof(struct ip4_addr)); memcpy(&lwip_netmask, &default_ip->netmask, sizeof(struct ip4_addr));
dhcps_set_new_lease_cb(esp_netif->dhcps, esp_netif_dhcps_cb, esp_netif); dhcps_set_new_lease_cb(esp_netif->dhcps, esp_netif_dhcps_cb, esp_netif);
dhcps_set_option_info(esp_netif->dhcps, SUBNET_MASK, (void*)&lwip_netmask, sizeof(lwip_netmask)); dhcps_set_option_info(esp_netif->dhcps, SUBNET_MASK, (void*)&lwip_netmask, sizeof(lwip_netmask));
dhcps_start(esp_netif->dhcps, p_netif, lwip_ip); if (dhcps_start(esp_netif->dhcps, p_netif, lwip_ip) != ERR_OK) {
ESP_LOGE(TAG, "DHCP server cannot be started");
esp_netif->dhcps_status = ESP_NETIF_DHCP_INIT;
return ESP_ERR_ESP_NETIF_DHCPS_START_FAILED;
}
esp_netif->dhcps_status = ESP_NETIF_DHCP_STARTED; esp_netif->dhcps_status = ESP_NETIF_DHCP_STARTED;
ESP_LOGD(TAG, "DHCP server started successfully"); ESP_LOGD(TAG, "DHCP server started successfully");
esp_netif_update_default_netif(esp_netif, ESP_NETIF_STARTED); esp_netif_update_default_netif(esp_netif, ESP_NETIF_STARTED);
@@ -1013,8 +1020,8 @@ static esp_err_t esp_netif_stop_api(esp_netif_api_msg_t *msg)
if (esp_netif->flags & ESP_NETIF_DHCP_SERVER) { if (esp_netif->flags & ESP_NETIF_DHCP_SERVER) {
#if ESP_DHCPS #if ESP_DHCPS
dhcps_stop(esp_netif->dhcps, lwip_netif); // TODO(IDF-1099): dhcps checks status by its self if (dhcps_stop(esp_netif->dhcps, lwip_netif) != ERR_OK ||
if (ESP_NETIF_DHCP_STOPPED != esp_netif->dhcps_status) { esp_netif->dhcps_status != ESP_NETIF_DHCP_STOPPED) {
esp_netif->dhcps_status = ESP_NETIF_DHCP_INIT; esp_netif->dhcps_status = ESP_NETIF_DHCP_INIT;
} }
#else #else
@@ -1357,7 +1364,11 @@ static esp_err_t esp_netif_dhcps_start_api(esp_netif_api_msg_t *msg)
memcpy(&lwip_netmask, &default_ip->netmask, sizeof(struct ip4_addr)); memcpy(&lwip_netmask, &default_ip->netmask, sizeof(struct ip4_addr));
dhcps_set_new_lease_cb(esp_netif->dhcps, esp_netif_dhcps_cb, esp_netif); dhcps_set_new_lease_cb(esp_netif->dhcps, esp_netif_dhcps_cb, esp_netif);
dhcps_set_option_info(esp_netif->dhcps, SUBNET_MASK, (void*)&lwip_netmask, sizeof(lwip_netmask)); dhcps_set_option_info(esp_netif->dhcps, SUBNET_MASK, (void*)&lwip_netmask, sizeof(lwip_netmask));
dhcps_start(esp_netif->dhcps, p_netif, lwip_ip); if (dhcps_start(esp_netif->dhcps, p_netif, lwip_ip) != ERR_OK) {
ESP_LOGE(TAG, "DHCP server cannot be started");
esp_netif->dhcps_status = ESP_NETIF_DHCP_INIT;
return ESP_ERR_ESP_NETIF_DHCPS_START_FAILED;
}
esp_netif->dhcps_status = ESP_NETIF_DHCP_STARTED; esp_netif->dhcps_status = ESP_NETIF_DHCP_STARTED;
ESP_LOGD(TAG, "DHCP server started successfully"); ESP_LOGD(TAG, "DHCP server started successfully");
return ESP_OK; return ESP_OK;
@@ -1382,9 +1393,7 @@ static esp_err_t esp_netif_dhcps_stop_api(esp_netif_api_msg_t *msg)
struct netif *p_netif = esp_netif->lwip_netif; struct netif *p_netif = esp_netif->lwip_netif;
if (esp_netif->dhcps_status == ESP_NETIF_DHCP_STARTED) { if (esp_netif->dhcps_status == ESP_NETIF_DHCP_STARTED) {
if (p_netif != NULL) { if (dhcps_stop(esp_netif->dhcps, p_netif) != ERR_OK) {
dhcps_stop(esp_netif->dhcps, p_netif);
} else {
ESP_LOGD(TAG, "dhcp server if not ready"); ESP_LOGD(TAG, "dhcp server if not ready");
return ESP_ERR_ESP_NETIF_IF_NOT_READY; return ESP_ERR_ESP_NETIF_IF_NOT_READY;
} }
@@ -1666,6 +1675,36 @@ static esp_err_t esp_netif_set_ip_info_api(esp_netif_api_msg_t *msg)
esp_err_t esp_netif_set_ip_info(esp_netif_t *esp_netif, const esp_netif_ip_info_t *ip_info) _RUN_IN_LWIP_TASK_IF_SUPPORTED(esp_netif_set_ip_info_api, esp_netif, ip_info) esp_err_t esp_netif_set_ip_info(esp_netif_t *esp_netif, const esp_netif_ip_info_t *ip_info) _RUN_IN_LWIP_TASK_IF_SUPPORTED(esp_netif_set_ip_info_api, esp_netif, ip_info)
struct array_mac_ip_t {
int num;
esp_netif_pair_mac_ip_t *mac_ip_pair;
};
#if CONFIG_LWIP_DHCPS
static esp_err_t esp_netif_dhcps_get_clients_by_mac_api(esp_netif_api_msg_t *msg)
{
esp_netif_t *netif = msg->esp_netif;
struct array_mac_ip_t *mac_ip_list = msg->data;
for (int i = 0; i < mac_ip_list->num; i++) {
dhcp_search_ip_on_mac(netif->dhcps, mac_ip_list->mac_ip_pair[i].mac, (ip4_addr_t*)&mac_ip_list->mac_ip_pair[i].ip);
}
return ESP_OK;
}
#endif // CONFIG_LWIP_DHCPS
esp_err_t esp_netif_dhcps_get_clients_by_mac(esp_netif_t *esp_netif, int num, esp_netif_pair_mac_ip_t *mac_ip_pair)
{
#if CONFIG_LWIP_DHCPS
if (esp_netif == NULL || esp_netif->dhcps == NULL || num < 0 || mac_ip_pair == NULL) {
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
}
struct array_mac_ip_t array_mac_ip = { num, mac_ip_pair };
return esp_netif_lwip_ipc_call(esp_netif_dhcps_get_clients_by_mac_api, esp_netif, (void *)&array_mac_ip);
#else
return ESP_ERR_NOT_SUPPORTED;
#endif // CONFIG_LWIP_DHCPS
}
static esp_err_t esp_netif_set_dns_info_api(esp_netif_api_msg_t *msg) static esp_err_t esp_netif_set_dns_info_api(esp_netif_api_msg_t *msg)
{ {
esp_netif_t *esp_netif = msg->esp_netif; esp_netif_t *esp_netif = msg->esp_netif;
@@ -2145,6 +2184,27 @@ esp_err_t esp_netif_get_netif_impl_name(esp_netif_t *esp_netif, char* name)
return ESP_OK; return ESP_OK;
} }
#if MIB2_STATS
static esp_err_t esp_netif_set_link_speed_api(esp_netif_api_msg_t *msg)
{
uint32_t speed = *((uint32_t*)msg->data);
esp_err_t error = ESP_OK;
ESP_LOGD(TAG, "%s esp_netif:%p", __func__, msg->esp_netif);
NETIF_INIT_SNMP(msg->esp_netif->lwip_netif, snmp_ifType_ethernet_csmacd, speed);
LWIP_UNUSED_ARG(speed); // Maybe unused if SNMP disabled
return error;
}
esp_err_t esp_netif_set_link_speed(esp_netif_t *esp_netif, uint32_t speed)
_RUN_IN_LWIP_TASK(esp_netif_set_link_speed_api, esp_netif, &speed)
#else
esp_err_t esp_netif_set_link_speed(esp_netif_t *esp_netif, uint32_t speed)
{
// link speed is used only to collect interface related statistics (if MIB2_STATS enabled)
return ESP_OK;
}
#endif /* MIB2_STATS */
#if CONFIG_LWIP_IPV6 #if CONFIG_LWIP_IPV6
static esp_err_t esp_netif_join_ip6_multicast_group_api(esp_netif_api_msg_t *msg) static esp_err_t esp_netif_join_ip6_multicast_group_api(esp_netif_api_msg_t *msg)

View File

@@ -6,16 +6,22 @@
#include "esp_netif.h" #include "esp_netif.h"
#include "esp_netif_lwip_internal.h" #include "esp_netif_lwip_internal.h"
#include "lwip/esp_netif_net_stack.h"
#include "esp_netif_lwip_ppp.h" #include "esp_netif_lwip_ppp.h"
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP) #if defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
#include "netif/wlanif.h" #if CONFIG_ESP_NETIF_BRIDGE_EN
#include "netif/ethernetif.h"
#include "netif/bridgeif.h" #include "netif/bridgeif.h"
#if CONFIG_OPENTHREAD_ENABLED
#include "netif/openthreadif.h" static const struct esp_netif_netstack_config s_br_netif_config = {
#endif .lwip = {
.init_fn = bridgeif_init,
.input_fn = NULL
}
};
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_br = &s_br_netif_config;
#endif // CONFIG_ESP_NETIF_BRIDGE_EN
// //
// Purpose of this object is to define default network stack configuration // Purpose of this object is to define default network stack configuration
@@ -28,12 +34,6 @@ static const struct esp_netif_netstack_config s_eth_netif_config = {
.input_fn = ethernetif_input .input_fn = ethernetif_input
} }
}; };
static const struct esp_netif_netstack_config s_br_netif_config = {
.lwip = {
.init_fn = bridgeif_init,
.input_fn = NULL
}
};
static const struct esp_netif_netstack_config s_wifi_netif_config_ap = { static const struct esp_netif_netstack_config s_wifi_netif_config_ap = {
.lwip = { .lwip = {
.init_fn = wlanif_init_ap, .init_fn = wlanif_init_ap,
@@ -59,19 +59,8 @@ static const struct esp_netif_netstack_config s_netif_config_ppp = {
}; };
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_eth = &s_eth_netif_config; const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_eth = &s_eth_netif_config;
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_br = &s_br_netif_config;
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_sta = &s_wifi_netif_config_sta; const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_sta = &s_wifi_netif_config_sta;
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_ap = &s_wifi_netif_config_ap; const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_ap = &s_wifi_netif_config_ap;
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_ppp = &s_netif_config_ppp; const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_ppp = &s_netif_config_ppp;
#if CONFIG_OPENTHREAD_ENABLED
static const struct esp_netif_netstack_config s_netif_config_openthread = {
.lwip = {
.init_fn = openthread_netif_init,
.input_fn = openthread_netif_input,
}
};
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_openthread = &s_netif_config_openthread;
#endif // CONFIG_OPENTHREAD_ENABLED
#endif /*CONFIG_ESP_NETIF_TCPIP_LWIP*/ #endif /*CONFIG_ESP_NETIF_TCPIP_LWIP*/

View File

@@ -14,30 +14,6 @@
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP) #if defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
struct esp_netif_netstack_lwip_vanilla_config {
err_t (*init_fn)(struct netif*);
void (*input_fn)(void *netif, void *buffer, size_t len, void *eb);
};
struct esp_netif_netstack_lwip_ppp_config {
void (*input_fn)(void *netif, void *buffer, size_t len, void *eb);
esp_netif_ppp_config_t ppp_events;
};
struct esp_netif_netstack_lwip_slip_config {
err_t (*init_fn)(struct netif*);
void (*input_fn)(void *netif, void *buffer, size_t len, void *eb);
esp_netif_slip_config_t slip_config;
};
// LWIP netif specific network stack configuration
struct esp_netif_netstack_config {
union {
struct esp_netif_netstack_lwip_vanilla_config lwip;
struct esp_netif_netstack_lwip_ppp_config lwip_ppp;
};
};
struct esp_netif_api_msg_s; struct esp_netif_api_msg_s;
typedef int (*esp_netif_api_fn)(struct esp_netif_api_msg_s *msg); typedef int (*esp_netif_api_fn)(struct esp_netif_api_msg_s *msg);

View File

@@ -1,16 +1,8 @@
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
@@ -19,6 +11,7 @@
#include "esp_netif_slip.h" #include "esp_netif_slip.h"
#include "esp_netif_lwip_internal.h" #include "esp_netif_lwip_internal.h"
#include "esp_netif_net_stack.h" #include "esp_netif_net_stack.h"
#include "lwip/esp_netif_net_stack.h"
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP #ifdef CONFIG_ESP_NETIF_TCPIP_LWIP

View File

@@ -1,40 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "esp_netif_lwip_internal.h"
#include "esp_netif_sta_list.h"
#include "dhcpserver/dhcpserver.h"
#include "esp_log.h"
#if CONFIG_ESP_NETIF_TCPIP_LWIP
static const char *TAG = "esp_netif_sta_list";
esp_err_t esp_netif_get_sta_list(const wifi_sta_list_t *wifi_sta_list, esp_netif_sta_list_t *netif_sta_list)
{
ESP_LOGD(TAG, "%s entered", __func__);
if ((wifi_sta_list == NULL) || (netif_sta_list == NULL)) {
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
}
esp_netif_t *ap = esp_netif_get_handle_from_ifkey("WIFI_AP_DEF");
if (ap == NULL) {
return ESP_ERR_ESP_NETIF_IF_NOT_READY;
}
memset(netif_sta_list, 0, sizeof(esp_netif_sta_list_t));
netif_sta_list->num = wifi_sta_list->num;
for (int i = 0; i < wifi_sta_list->num; i++) {
memcpy(netif_sta_list->sta[i].mac, wifi_sta_list->sta[i].mac, 6);
#if CONFIG_LWIP_DHCPS
dhcp_search_ip_on_mac(ap->dhcps, netif_sta_list->sta[i].mac, (ip4_addr_t*)&netif_sta_list->sta[i].ip);
#endif
}
return ESP_OK;
}
#endif // CONFIG_ESP_NETIF_TCPIP_LWIP

View File

@@ -9,9 +9,9 @@
* and the L2 free function esp_netif_free_rx_buffer() * and the L2 free function esp_netif_free_rx_buffer()
*/ */
#include "netif/esp_pbuf_ref.h"
#include "esp_netif_net_stack.h"
#include "lwip/mem.h" #include "lwip/mem.h"
#include "lwip/esp_pbuf_ref.h"
#include "esp_netif_net_stack.h"
/** /**
* @brief Specific pbuf structure for pbufs allocated by ESP netif * @brief Specific pbuf structure for pbufs allocated by ESP netif
@@ -37,7 +37,14 @@ static void esp_pbuf_free(struct pbuf *pbuf)
mem_free(pbuf); mem_free(pbuf);
} }
/**
* @brief Allocate custom pbuf for supplied sp_netif
* @param esp_netif esp-netif handle
* @param buffer Buffer to allocate
* @param len Size of the buffer
* @param l2_buff External l2 buffe
* @return Custom pbuf pointer on success; NULL if no free heap
*/
struct pbuf* esp_pbuf_allocate(esp_netif_t *esp_netif, void *buffer, size_t len, void *l2_buff) struct pbuf* esp_pbuf_allocate(esp_netif_t *esp_netif, void *buffer, size_t len, void *l2_buff)
{ {
struct pbuf *p; struct pbuf *p;

View File

@@ -1,58 +1,27 @@
/*
* SPDX-FileCopyrightText: 2001-2004 Swedish Institute of Computer Science
*
* SPDX-License-Identifier: BSD-3-Clause
*
* SPDX-FileContributor: 2015-2022 Espressif Systems (Shanghai) CO LTD
*/
/** /**
* @file * @file
* Ethernet Interface Skeleton * Ethernet Interface Skeleton
* *
*/ */
/*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/mem.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"
#include "lwip/snmp.h"
#include "lwip/ethip6.h"
#include "netif/etharp.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "lwip/opt.h"
#include "lwip/pbuf.h"
#include "lwip/ethip6.h"
#include "netif/etharp.h"
#include "esp_eth_driver.h"
#include "esp_netif.h" #include "esp_netif.h"
#include "esp_netif_net_stack.h" #include "esp_netif_net_stack.h"
#include "esp_compiler.h" #include "esp_compiler.h"
#include "netif/esp_pbuf_ref.h" #include "lwip/esp_pbuf_ref.h"
/* Define those to better describe your network interface. */ /* Define those to better describe your network interface. */
#define IFNAME0 'e' #define IFNAME0 'e'
@@ -127,7 +96,8 @@ static err_t ethernet_low_level_output(struct netif *netif, struct pbuf *p)
/* Check error */ /* Check error */
if (likely(ret == ESP_OK)) { if (likely(ret == ESP_OK)) {
return ERR_OK; return ERR_OK;
} else if (ret == ESP_ERR_NO_MEM) { }
if (ret == ESP_ERR_NO_MEM) {
return ERR_MEM; return ERR_MEM;
} }
return ERR_IF; return ERR_IF;
@@ -186,7 +156,7 @@ err_t ethernetif_init(struct netif *netif)
LWIP_ASSERT("netif != NULL", (netif != NULL)); LWIP_ASSERT("netif != NULL", (netif != NULL));
/* Have to get the esp-netif handle from netif first and then driver==ethernet handle from there */ /* Have to get the esp-netif handle from netif first and then driver==ethernet handle from there */
esp_netif_t *esp_netif = esp_netif_get_handle_from_netif_impl(netif); esp_netif_t *esp_netif = esp_netif_get_handle_from_netif_impl(netif);
esp_eth_handle_t eth_handle = esp_netif_get_io_driver(esp_netif);
/* Initialize interface hostname */ /* Initialize interface hostname */
#if LWIP_NETIF_HOSTNAME #if LWIP_NETIF_HOSTNAME
#if ESP_LWIP #if ESP_LWIP
@@ -199,16 +169,6 @@ err_t ethernetif_init(struct netif *netif)
#endif /* LWIP_NETIF_HOSTNAME */ #endif /* LWIP_NETIF_HOSTNAME */
/* Initialize the snmp variables and counters inside the struct netif. */
eth_speed_t speed;
esp_eth_ioctl(eth_handle, ETH_CMD_G_SPEED, &speed);
if (speed == ETH_SPEED_100M) {
NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, 100000000);
} else {
NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, 10000000);
}
netif->name[0] = IFNAME0; netif->name[0] = IFNAME0;
netif->name[1] = IFNAME1; netif->name[1] = IFNAME1;
netif->output = etharp_output; netif->output = etharp_output;

View File

@@ -0,0 +1,230 @@
/*
* SPDX-FileCopyrightText: 2001-2004 Swedish Institute of Computer Science
*
* SPDX-License-Identifier: BSD-3-Clause
*
* SPDX-FileContributor: 2015-2022 Espressif Systems (Shanghai) CO LTD
*/
/**
* @file
* Ethernet Interface Skeleton used for WiFi
*
*/
#include <stdio.h>
#include <string.h>
#include "lwip/opt.h"
#include "lwip/pbuf.h"
#include "lwip/snmp.h"
#include "lwip/ethip6.h"
#include "netif/etharp.h"
#include "esp_netif.h"
#include "esp_netif_net_stack.h"
#include "lwip/esp_netif_net_stack.h"
#include "esp_compiler.h"
#include "lwip/esp_pbuf_ref.h"
/**
* In this function, the hardware should be initialized.
* Called from wlanif_input().
*
* @param netif the already initialized lwip network interface structure
* for this wlanif
*/
static void
low_level_init(struct netif *netif)
{
/* set MAC hardware address length */
netif->hwaddr_len = ETHARP_HWADDR_LEN;
/* set MAC hardware address */
/* maximum transfer unit */
netif->mtu = 1500;
/* device capabilities */
/* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;
#if ESP_LWIP
#if LWIP_IGMP
netif->flags |= NETIF_FLAG_IGMP;
#endif
#endif
#if ESP_IPV6
#if LWIP_IPV6 && LWIP_IPV6_MLD
netif->flags |= NETIF_FLAG_MLD6;
#endif
#endif
}
/**
* This function should do the actual transmission of the packet. The packet is
* contained in the pbuf that is passed to the function. This pbuf
* might be chained.
*
* @param netif the lwip network interface structure for this wlanif
* @param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
* @return ERR_OK if the packet could be sent
* an err_t value if the packet couldn't be sent
*
* @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
* strange results. You might consider waiting for space in the DMA queue
* to become available since the stack doesn't retry to send a packet
* dropped because of memory failure (except for the TCP timers).
*/
static err_t low_level_output(struct netif *netif, struct pbuf *p)
{
esp_netif_t *esp_netif = netif->state;
if (esp_netif == NULL) {
return ERR_IF;
}
struct pbuf *q = p;
esp_err_t ret;
if(q->next == NULL) {
ret = esp_netif_transmit_wrap(esp_netif, q->payload, q->len, q);
} else {
LWIP_DEBUGF(PBUF_DEBUG, ("low_level_output: pbuf is a list, application may has bug"));
q = pbuf_alloc(PBUF_RAW_TX, p->tot_len, PBUF_RAM);
if (q != NULL) {
pbuf_copy(q, p);
} else {
return ERR_MEM;
}
ret = esp_netif_transmit_wrap(esp_netif, q->payload, q->len, q);
pbuf_free(q);
}
if (ret == ESP_OK) {
return ERR_OK;
}
if (ret == ESP_ERR_NO_MEM) {
return ERR_MEM;
}
if (ret == ESP_ERR_INVALID_ARG) {
return ERR_ARG;
}
return ERR_IF;
}
/**
* This function should be called when a packet is ready to be read
* from the interface. It uses the function low_level_input() that
* should handle the actual reception of bytes from the network
* interface. Then the type of the received packet is determined and
* the appropriate input function is called.
*
* @param h lwip network interface structure (struct netif) for this ethernetif
* @param buffer wlan buffer
* @param len length of buffer
* @param l2_buff wlan's L2 buffer pointer
*/
void wlanif_input(void *h, void *buffer, size_t len, void* l2_buff)
{
struct netif * netif = h;
esp_netif_t *esp_netif = netif->state;
struct pbuf *p;
if(unlikely(!buffer || !netif_is_up(netif))) {
if (l2_buff) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
}
return;
}
#ifdef CONFIG_LWIP_L2_TO_L3_COPY
p = pbuf_alloc(PBUF_RAW, len, PBUF_RAM);
if (p == NULL) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
return;
}
memcpy(p->payload, buffer, len);
esp_netif_free_rx_buffer(esp_netif, l2_buff);
#else
p = esp_pbuf_allocate(esp_netif, buffer, len, l2_buff);
if (p == NULL) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
return;
}
#endif
/* full packet send to tcpip_thread to process */
if (unlikely(netif->input(p, netif) != ERR_OK)) {
LWIP_DEBUGF(NETIF_DEBUG, ("wlanif_input: IP input error\n"));
pbuf_free(p);
}
}
/**
* Should be called at the beginning of the program to set up the
* network interface. It calls the function low_level_init() to do the
* actual setup of the hardware.
*
* This function should be passed as a parameter to netif_add().
*
* @param netif the lwip network interface structure for this wlanif
* @return ERR_OK if the loopif is initialized
* ERR_MEM if private data couldn't be allocated
* any other err_t on error
*/
err_t
wlanif_init(struct netif *netif)
{
LWIP_ASSERT("netif != NULL", (netif != NULL));
#if LWIP_NETIF_HOSTNAME
/* Initialize interface hostname */
#if ESP_LWIP
if (esp_netif_get_hostname(esp_netif_get_handle_from_netif_impl(netif), &netif->hostname) != ESP_OK) {
netif->hostname = CONFIG_LWIP_LOCAL_HOSTNAME;
}
#else
netif->hostname = "lwip";
#endif
#endif /* LWIP_NETIF_HOSTNAME */
/*
* Initialize the snmp variables and counters inside the struct netif.
* The last argument should be replaced with your link speed, in units
* of bits per second.
*/
NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, 100);
/* We directly use etharp_output() here to save a function call.
* You can instead declare your own function an call etharp_output()
* from it if you have to do some checks before sending (e.g. if link
* is available...) */
netif->output = etharp_output;
#if LWIP_IPV6
netif->output_ip6 = ethip6_output;
#endif /* LWIP_IPV6 */
netif->linkoutput = low_level_output;
/* initialize the hardware */
low_level_init(netif);
return ERR_OK;
}
err_t wlanif_init_sta(struct netif *netif) {
netif->name[0] = 's';
netif->name[1] = 't';
return wlanif_init(netif);
}
err_t wlanif_init_ap(struct netif *netif) {
netif->name[0] = 'a';
netif->name[1] = 'p';
return wlanif_init(netif);
}

View File

@@ -1,3 +1,3 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "../private_include" "." PRIV_INCLUDE_DIRS "../private_include" "."
PRIV_REQUIRES cmock test_utils esp_netif nvs_flash driver esp_eth) PRIV_REQUIRES cmock test_utils esp_netif nvs_flash driver esp_eth esp_wifi)

View File

@@ -2,4 +2,4 @@ idf_component_register(SRCS "esp_netif_test.c"
REQUIRES test_utils REQUIRES test_utils
INCLUDE_DIRS "." INCLUDE_DIRS "."
PRIV_INCLUDE_DIRS "$ENV{IDF_PATH}/components/esp_netif/private_include" "." PRIV_INCLUDE_DIRS "$ENV{IDF_PATH}/components/esp_netif/private_include" "."
PRIV_REQUIRES unity esp_netif nvs_flash) PRIV_REQUIRES unity esp_netif nvs_flash esp_wifi)

View File

@@ -31,7 +31,7 @@ endif()
# [refactor-todo]: requires "driver" component for periph_ctrl header file # [refactor-todo]: requires "driver" component for periph_ctrl header file
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include" "${idf_target}/include" INCLUDE_DIRS "include" "${idf_target}/include"
PRIV_REQUIRES nvs_flash driver efuse esp_timer esp_adc PRIV_REQUIRES nvs_flash driver efuse esp_timer esp_adc esp_wifi
LDFRAGMENTS "${ldfragments}" LDFRAGMENTS "${ldfragments}"
EMBED_FILES ${embed_files} EMBED_FILES ${embed_files}
) )

View File

@@ -1,4 +1,4 @@
idf_component_register(SRC_DIRS . idf_component_register(SRC_DIRS .
PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR} PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR}
PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common esp_phy PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common esp_phy esp_wifi
) )

View File

@@ -24,13 +24,14 @@ if(CONFIG_ESP32_WIFI_ENABLED)
"src/wifi_init.c" "src/wifi_init.c"
"src/wifi_default.c" "src/wifi_default.c"
"src/wifi_netif.c" "src/wifi_netif.c"
"src/wifi_default_ap.c"
"${idf_target}/esp_adapter.c") "${idf_target}/esp_adapter.c")
endif() endif()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include" INCLUDE_DIRS "include"
REQUIRES esp_event esp_phy REQUIRES esp_event esp_phy esp_netif
PRIV_REQUIRES driver esptool_py esp_netif esp_pm esp_timer nvs_flash esp_adc PRIV_REQUIRES driver esptool_py esp_pm esp_timer nvs_flash esp_adc
wpa_supplicant hal lwip ${extra_priv_requires} wpa_supplicant hal lwip ${extra_priv_requires}
LDFRAGMENTS "${ldfragments}") LDFRAGMENTS "${ldfragments}")

View File

@@ -4,40 +4,22 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#ifndef _ESP_NETIF_STA_LIST_H_ #pragma once
#define _ESP_NETIF_STA_LIST_H_
#include "esp_netif_types.h" #include "esp_netif_types.h"
#include "esp_wifi_types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/**
* @brief station list info element
*/
typedef struct {
uint8_t mac[6]; /**< Station MAC address */
esp_ip4_addr_t ip; /**< Station assigned IP address */
} esp_netif_sta_info_t;
/** /**
* @brief station list structure * @brief station list structure
*/ */
typedef struct { typedef struct {
esp_netif_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]; /**< Connected stations */ int num; /**< Number of connected stations */
int num; /**< Number of connected stations */ esp_netif_pair_mac_ip_t sta[ESP_WIFI_MAX_CONN_NUM]; /**< Connected stations */
} esp_netif_sta_list_t; } wifi_sta_mac_ip_list_t;
/**
* @defgroup ESP_NETIF_STA_LIST ESP-NETIF STA list api
* @brief List of stations for Wi-Fi AP interface
*
*/
/** @addtogroup ESP_NETIF_STA_LIST
* @{
*/
/** /**
* @brief Get IP information for stations connected to the Wi-Fi AP interface * @brief Get IP information for stations connected to the Wi-Fi AP interface
@@ -54,7 +36,7 @@ typedef struct {
* - ESP_ERR_ESP_NETIF_NO_MEM * - ESP_ERR_ESP_NETIF_NO_MEM
* - ESP_ERR_ESP_NETIF_INVALID_PARAMS * - ESP_ERR_ESP_NETIF_INVALID_PARAMS
*/ */
esp_err_t esp_netif_get_sta_list(const wifi_sta_list_t *wifi_sta_list, esp_netif_sta_list_t *netif_sta_list); esp_err_t esp_wifi_ap_get_sta_list_with_ip(const wifi_sta_list_t *wifi_sta_list, wifi_sta_mac_ip_list_t *wifi_sta_ip_mac_list);
/** /**
* @} * @}
@@ -63,5 +45,3 @@ esp_err_t esp_netif_get_sta_list(const wifi_sta_list_t *wifi_sta_list, esp_netif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif //_ESP_NETIF_STA_LIST_H_

View File

@@ -1,19 +1,10 @@
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
// http://www.apache.org/licenses/LICENSE-2.0 #pragma once
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ESP_WIFI_NETIF_H
#define _ESP_WIFI_NETIF_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -67,8 +58,8 @@ esp_err_t esp_wifi_get_if_mac(wifi_netif_driver_t ifx, uint8_t mac[6]);
* @param[in] ifx pointer to wifi interface handle * @param[in] ifx pointer to wifi interface handle
* *
* @return * @return
* - true if ready after intertace started (typically Access Point type) * - true if ready after interface started (typically Access Point type)
* - false if ready once intertace connected (typically for Station type) * - false if ready once interface connected (typically for Station type)
*/ */
bool esp_wifi_is_if_ready_when_started(wifi_netif_driver_t ifx); bool esp_wifi_is_if_ready_when_started(wifi_netif_driver_t ifx);
@@ -76,7 +67,7 @@ bool esp_wifi_is_if_ready_when_started(wifi_netif_driver_t ifx);
* @brief Register interface receive callback function with argument * @brief Register interface receive callback function with argument
* *
* @param[in] ifx pointer to wifi interface handle * @param[in] ifx pointer to wifi interface handle
* @param[in] fn funtion to be registered (typically esp_netif_receive) * @param[in] fn function to be registered (typically esp_netif_receive)
* @param[in] arg argument to be supplied to registered function (typically esp_netif ptr) * @param[in] arg argument to be supplied to registered function (typically esp_netif ptr)
* *
* @return ESP_OK on success * @return ESP_OK on success
@@ -87,5 +78,3 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif //_ESP_WIFI_NETIF_H

View File

@@ -134,7 +134,7 @@ static void wifi_default_action_sta_got_ip(void *arg, esp_event_base_t base, int
/** /**
* @brief Clear default handlers * @brief Clear default handlers
*/ */
esp_err_t _esp_wifi_clear_default_wifi_handlers(void) static esp_err_t clear_default_wifi_handlers(void)
{ {
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_START, wifi_default_action_sta_start); esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_START, wifi_default_action_sta_start);
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_STOP, wifi_default_action_sta_stop); esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_STOP, wifi_default_action_sta_stop);
@@ -153,7 +153,7 @@ esp_err_t _esp_wifi_clear_default_wifi_handlers(void)
/** /**
* @brief Set default handlers * @brief Set default handlers
*/ */
esp_err_t _esp_wifi_set_default_wifi_handlers(void) static esp_err_t set_default_wifi_handlers(void)
{ {
if (wifi_default_handlers_set) { if (wifi_default_handlers_set) {
return ESP_OK; return ESP_OK;
@@ -205,7 +205,7 @@ esp_err_t _esp_wifi_set_default_wifi_handlers(void)
return ESP_OK; return ESP_OK;
fail: fail:
_esp_wifi_clear_default_wifi_handlers(); clear_default_wifi_handlers();
return err; return err;
} }
@@ -214,7 +214,7 @@ fail:
*/ */
esp_err_t esp_wifi_set_default_wifi_sta_handlers(void) esp_err_t esp_wifi_set_default_wifi_sta_handlers(void)
{ {
return _esp_wifi_set_default_wifi_handlers(); return set_default_wifi_handlers();
} }
/** /**
@@ -222,7 +222,7 @@ esp_err_t esp_wifi_set_default_wifi_sta_handlers(void)
*/ */
esp_err_t esp_wifi_set_default_wifi_ap_handlers(void) esp_err_t esp_wifi_set_default_wifi_ap_handlers(void)
{ {
return _esp_wifi_set_default_wifi_handlers(); return set_default_wifi_handlers();
} }
/** /**
@@ -246,7 +246,7 @@ esp_err_t esp_wifi_clear_default_wifi_driver_and_handlers(void *esp_netif)
if (i == MAX_WIFI_IFS) { // if all wifi default netifs are null if (i == MAX_WIFI_IFS) { // if all wifi default netifs are null
ESP_LOGD(TAG, "Clearing wifi default handlers"); ESP_LOGD(TAG, "Clearing wifi default handlers");
_esp_wifi_clear_default_wifi_handlers(); clear_default_wifi_handlers();
} }
return disconnect_and_destroy(esp_netif); return disconnect_and_destroy(esp_netif);
} }

View File

@@ -0,0 +1,29 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "esp_log.h"
#include "esp_netif.h"
#include "esp_wifi_ap_get_sta_list.h"
esp_err_t esp_wifi_ap_get_sta_list_with_ip(const wifi_sta_list_t *wifi_sta_list, wifi_sta_mac_ip_list_t *wifi_sta_ip_mac_list)
{
if ((wifi_sta_list == NULL) || (wifi_sta_ip_mac_list == NULL)) {
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
}
esp_netif_t *ap = esp_netif_get_handle_from_ifkey("WIFI_AP_DEF");
if (ap == NULL) {
return ESP_ERR_ESP_NETIF_IF_NOT_READY;
}
int num = wifi_sta_list->num;
wifi_sta_ip_mac_list->num = num;
for (int i = 0; i < num; i++) {
memcpy(wifi_sta_ip_mac_list->sta[i].mac, wifi_sta_list->sta[i].mac, 6);
memset(&wifi_sta_ip_mac_list->sta[i].ip, 0, sizeof(esp_ip4_addr_t));
}
return esp_netif_dhcps_get_clients_by_mac(ap, num, wifi_sta_ip_mac_list->sta);
}

View File

@@ -5,8 +5,6 @@
*/ */
#include "esp_wifi.h" #include "esp_wifi.h"
#include "esp_netif.h" #include "esp_netif.h"
#include "esp_netif_net_stack.h"
#include "netif/wlanif.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_private/wifi.h" #include "esp_private/wifi.h"
#include "esp_wifi_netif.h" #include "esp_wifi_netif.h"
@@ -19,13 +17,35 @@
/** /**
* @brief WiFi netif driver structure * @brief WiFi netif driver structure
*/ */
typedef struct wifi_netif_driver { struct wifi_netif_driver {
esp_netif_driver_base_t base; esp_netif_driver_base_t base;
wifi_interface_t wifi_if; wifi_interface_t wifi_if;
}* wifi_netif_driver_t; };
static const char* TAG = "wifi_netif"; static const char* TAG = "wifi_netif";
/**
* @brief Local storage for netif handles and callbacks for specific wifi interfaces
*/
static esp_netif_receive_t s_wifi_rxcbs[MAX_WIFI_IFS] = { NULL };
static esp_netif_t *s_wifi_netifs[MAX_WIFI_IFS] = { NULL };
/**
* @brief WiFi netif driver IO functions, a thin glue layer
* to the original wifi interface API
*/
static esp_err_t wifi_sta_receive(void *buffer, uint16_t len, void *eb)
{
return s_wifi_rxcbs[WIFI_IF_STA](s_wifi_netifs[WIFI_IF_STA], buffer, len, eb);
}
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
static esp_err_t wifi_ap_receive(void *buffer, uint16_t len, void *eb)
{
return s_wifi_rxcbs[WIFI_IF_AP](s_wifi_netifs[WIFI_IF_AP], buffer, len, eb);
}
#endif
static void wifi_free(void *h, void* buffer) static void wifi_free(void *h, void* buffer)
{ {
if (buffer) { if (buffer) {
@@ -68,6 +88,7 @@ void esp_wifi_destroy_if_driver(wifi_netif_driver_t h)
if (h) { if (h) {
esp_wifi_internal_reg_rxcb(h->wifi_if, NULL); // ignore the potential error esp_wifi_internal_reg_rxcb(h->wifi_if, NULL); // ignore the potential error
// as the wifi might have been already uninitialized // as the wifi might have been already uninitialized
s_wifi_netifs[h->wifi_if] = NULL;
} }
free(h); free(h);
} }
@@ -108,6 +129,7 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
wifi_interface_t wifi_interface = ifx->wifi_if; wifi_interface_t wifi_interface = ifx->wifi_if;
s_wifi_rxcbs[wifi_interface] = fn;
wifi_rxcb_t rxcb = NULL; wifi_rxcb_t rxcb = NULL;
esp_err_t ret; esp_err_t ret;
@@ -115,12 +137,12 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t
{ {
case WIFI_IF_STA: case WIFI_IF_STA:
rxcb = wifi_rxcb_sta; rxcb = wifi_sta_receive;
break; break;
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT #ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
case WIFI_IF_AP: case WIFI_IF_AP:
rxcb = wifi_rxcb_ap; rxcb = wifi_ap_receive;
break; break;
#endif #endif
@@ -134,12 +156,10 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t
} }
/* Interface must be set before registering Wi-Fi RX callback */ /* Interface must be set before registering Wi-Fi RX callback */
set_wifi_netif(wifi_interface, esp_netif_get_netif_impl(arg)); s_wifi_netifs[wifi_interface] = ifx->base.netif;
if ((ret = esp_wifi_internal_reg_rxcb(wifi_interface, rxcb)) != ESP_OK) { if ((ret = esp_wifi_internal_reg_rxcb(wifi_interface, rxcb)) != ESP_OK) {
ESP_LOGE(TAG, "esp_wifi_internal_reg_rxcb for if=%d failed with %d", wifi_interface, ret); ESP_LOGE(TAG, "esp_wifi_internal_reg_rxcb for if=%d failed with %d", wifi_interface, ret);
return ESP_ERR_INVALID_STATE; return ESP_ERR_INVALID_STATE;
} }
return ESP_OK; return ESP_OK;
} }

View File

@@ -1,4 +1,4 @@
idf_component_register(SRC_DIRS . idf_component_register(SRC_DIRS .
PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR} PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR}
PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common esp_wifi esp_event
) )

View File

@@ -11,5 +11,6 @@ set(srcs "diskio/diskio.c"
idf_component_register(SRCS ${srcs} idf_component_register(SRCS ${srcs}
INCLUDE_DIRS diskio vfs src INCLUDE_DIRS diskio vfs src
REQUIRES wear_levelling sdmmc vfs REQUIRES wear_levelling sdmmc
PRIV_REQUIRES vfs
) )

View File

@@ -89,9 +89,7 @@ set(srcs
"port/esp32/hooks/lwip_default_hooks.c" "port/esp32/hooks/lwip_default_hooks.c"
"port/esp32/debug/lwip_debug.c" "port/esp32/debug/lwip_debug.c"
"port/esp32/freertos/sys_arch.c" "port/esp32/freertos/sys_arch.c"
"port/esp32/sockets_ext.c" "port/esp32/sockets_ext.c")
"port/esp32/netif/wlanif.c"
"port/esp32/netif/esp_pbuf_ref.c")
if(CONFIG_LWIP_PPP_SUPPORT) if(CONFIG_LWIP_PPP_SUPPORT)
list(APPEND srcs list(APPEND srcs
@@ -127,20 +125,12 @@ if(CONFIG_LWIP_PPP_SUPPORT)
"lwip/src/netif/ppp/polarssl/sha1.c") "lwip/src/netif/ppp/polarssl/sha1.c")
endif() endif()
if(CONFIG_ETH_ENABLED)
list(APPEND srcs "port/esp32/netif/ethernetif.c")
endif()
if(CONFIG_VFS_SUPPORT_IO) if(CONFIG_VFS_SUPPORT_IO)
list(APPEND srcs "port/esp32/vfs_lwip.c") list(APPEND srcs "port/esp32/vfs_lwip.c")
else() else()
list(APPEND srcs "port/esp32/no_vfs_syscalls.c") list(APPEND srcs "port/esp32/no_vfs_syscalls.c")
endif() endif()
if(CONFIG_OPENTHREAD_ENABLED)
list(APPEND srcs "port/esp32/netif/openthreadif.c")
endif()
if(CONFIG_LWIP_ICMP) if(CONFIG_LWIP_ICMP)
list(APPEND srcs list(APPEND srcs
"apps/ping/esp_ping.c" "apps/ping/esp_ping.c"
@@ -159,8 +149,7 @@ endif()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}" INCLUDE_DIRS "${include_dirs}"
LDFRAGMENTS linker.lf LDFRAGMENTS linker.lf
REQUIRES vfs esp_wifi PRIV_REQUIRES vfs)
PRIV_REQUIRES esp_netif)
# lots of LWIP source files evaluate macros that check address of stack variables # lots of LWIP source files evaluate macros that check address of stack variables
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-address) target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-address)

View File

@@ -78,13 +78,6 @@ entries:
sys_arch:sys_mbox_post (noflash_text) sys_arch:sys_mbox_post (noflash_text)
sys_arch:sys_mbox_trypost (noflash_text) sys_arch:sys_mbox_trypost (noflash_text)
sys_arch:sys_arch_mbox_fetch (noflash_text) sys_arch:sys_arch_mbox_fetch (noflash_text)
ethernetif:ethernet_low_level_output (noflash_text)
ethernetif:ethernetif_input (noflash_text)
wlanif:sta_output (noflash_text)
wlanif:ap_output (noflash_text)
wlanif:wifi_rxcb_sta (noflash_text)
wlanif:wifi_rxcb_ap (noflash_text)
wlanif:wifi_pbuf_free (noflash_text)
lwip_default_hooks:ip4_route_src_hook (noflash_text) lwip_default_hooks:ip4_route_src_hook (noflash_text)
if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y: if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y:

View File

@@ -1,35 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ETH_LWIP_IF_H_
#define _ETH_LWIP_IF_H_
#include "lwip/err.h"
#ifdef __cplusplus
extern "C" {
#endif
err_t ethernetif_init(struct netif *netif);
void ethernetif_input(void *netif, void *buffer, size_t len, void *eb);
void netif_reg_addr_change_cb(void* cb);
#ifdef __cplusplus
}
#endif
#endif /* _ETH_LWIP_IF_H_ */

View File

@@ -1,52 +0,0 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
#ifndef _OPENTHREAD_LWIP_IF_H_
#define _OPENTHREAD_LWIP_IF_H_
#include "lwip/netif.h"
#include "lwip/err.h"
#include "lwip/ip6.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief This function initializes the OpenThread lwIP network interface.
*
* @param[in] netif The lwIP interface to initialize
*
* @return
* - ERR_OK
*
*/
err_t openthread_netif_init(struct netif *netif);
/**
* @brief This function sends the buffer to the lwIP network interface
*
* @param[in] netif The lwIP interface to send to.
* @param[in] buffer The packet to send.
* @param[in] len The length of the buffer.
* @param[in] eb Unused.
*
*/
void openthread_netif_input(void *netif, void *buffer, size_t len, void *eb);
#ifdef __cplusplus
}
#endif
#endif /* _OPENTHREAD_LWIP_IF_H_ */

View File

@@ -1,39 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _WLAN_LWIP_IF_H_
#define _WLAN_LWIP_IF_H_
#include "esp_wifi.h"
#include "lwip/err.h"
#include "lwip/netif.h"
#ifdef __cplusplus
extern "C" {
#endif
err_t wlanif_init_ap(struct netif *netif);
err_t wlanif_init_sta(struct netif *netif);
err_t set_wifi_netif(int wifi_inx, void* netif);
esp_err_t wifi_rxcb_sta(void *buffer, uint16_t len, void *l2_buff);
esp_err_t wifi_rxcb_ap(void *buffer, uint16_t len, void *l2_buff);
void wlanif_input(void *netif, void *buffer, size_t len, void* eb);
err_t wlanif_init(struct netif *netif);
wifi_interface_t wifi_get_interface(void *dev);
void netif_reg_addr_change_cb(void* cb);
#ifdef __cplusplus
}
#endif
#endif /* _WLAN_LWIP_IF_H_ */

View File

@@ -1,132 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "esp_netif.h"
#include "esp_netif_net_stack.h"
#include "lwip/err.h"
#include "lwip/netif.h"
#include "lwip/pbuf.h"
#include "netif/openthreadif.h"
#include "esp_openthread.h"
#include "esp_openthread_lock.h"
#include "openthread/error.h"
#include "openthread/ip6.h"
#include "openthread/link.h"
#include "openthread/message.h"
#define OPENTHREAD_IP6_MTU 1280
static err_t openthread_output_ip6(struct netif *netif, struct pbuf *p, const struct ip6_addr *peer_addr)
{
struct pbuf *q = p;
esp_netif_t *esp_netif = esp_netif_get_handle_from_netif_impl(netif);
esp_err_t ret = ESP_FAIL;
if (!esp_netif) {
LWIP_DEBUGF(NETIF_DEBUG, ("corresponding esp-netif is NULL: netif=%p pbuf=%p len=%d\n", netif, p, p->len));
return ERR_IF;
}
if (q->next == NULL) {
ret = esp_netif_transmit(esp_netif, q->payload, q->len);
} else {
LWIP_DEBUGF(PBUF_DEBUG, ("low_level_output: pbuf is a list, application may has bug"));
q = pbuf_alloc(PBUF_RAW_TX, p->tot_len, PBUF_RAM);
if (q != NULL) {
pbuf_copy(q, p);
} else {
return ERR_MEM;
}
ret = esp_netif_transmit(esp_netif, q->payload, q->len);
/* content in payload has been copied to OpenThread queue, it's safe to free pbuf now */
pbuf_free(q);
}
/* Check error */
switch (ret) {
case ESP_ERR_NO_MEM:
return ERR_MEM;
case ESP_OK:
return ERR_OK;
default:
return ERR_ABRT;
}
}
void openthread_netif_input(void *h, void *buffer, size_t len, void *eb)
{
struct netif *netif = h;
struct pbuf *p;
otMessage *message = (otMessage *)buffer;
if (unlikely(buffer == NULL || !netif_is_up(netif))) {
return;
}
/* Allocate LINK buffer in case it's forwarded to WiFi/ETH */
p = pbuf_alloc(PBUF_LINK, len, PBUF_POOL);
if (p == NULL) {
LWIP_DEBUGF(NETIF_DEBUG, ("Failed to allocate input pbuf for OpenThread netif\n"));
return;
}
if (unlikely(otMessageRead(message, 0, p->payload, len) != OT_ERROR_NONE)) {
LWIP_DEBUGF(NETIF_DEBUG, ("Failed to read OpenThread message\n"));
}
/* full packet send to tcpip_thread to process */
if (unlikely(netif->input(p, netif) != ERR_OK)) {
LWIP_DEBUGF(NETIF_DEBUG, ("openthread_netif_input: IP input error\n"));
pbuf_free(p);
}
/* the pbuf will be free in upper layer, eg: tcpip_input */
}
static err_t openthread_netif_multicast_handler(struct netif *netif,
const ip6_addr_t *group, enum netif_mac_filter_action action)
{
otError error = OT_ERROR_NONE;
otIp6Address multicast_addr;
memcpy(multicast_addr.mFields.m8, group->addr, sizeof(group->addr));
esp_openthread_lock_acquire(portMAX_DELAY);
if (action == NETIF_ADD_MAC_FILTER) {
error = otIp6SubscribeMulticastAddress(esp_openthread_get_instance(), &multicast_addr);
} else {
error = otIp6UnsubscribeMulticastAddress(esp_openthread_get_instance(), &multicast_addr);
}
esp_openthread_lock_release();
switch (error) {
case OT_ERROR_NONE:
case OT_ERROR_ALREADY:
return ERR_OK;
case OT_ERROR_NO_BUFS:
return ERR_MEM;
case OT_ERROR_INVALID_ARGS:
return ERR_ARG;
default:
return ERR_IF;
}
}
err_t openthread_netif_init(struct netif *netif)
{
netif->name[0] = 'o';
netif->name[1] = 't';
netif->hwaddr_len = sizeof(otExtAddress);
memset(netif->hwaddr, 0, sizeof(netif->hwaddr));
netif->mtu = OPENTHREAD_IP6_MTU;
netif->flags = NETIF_FLAG_BROADCAST;
netif->output = NULL;
netif->output_ip6 = openthread_output_ip6;
netif->mld_mac_filter = openthread_netif_multicast_handler;
netif_set_link_up(netif);
return ERR_OK;
}

View File

@@ -1,362 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2004 Swedish Institute of Computer Science
*
* SPDX-License-Identifier: BSD-3-Clause
*
* SPDX-FileContributor: 2015-2022 Espressif Systems (Shanghai) CO LTD
*/
/**
* @file
* Ethernet Interface Skeleton used for WiFi
*
*/
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/mem.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"
#include "lwip/snmp.h"
#include "lwip/ethip6.h"
#include "netif/etharp.h"
#include "netif/wlanif.h"
#include "esp_private/wifi.h"
#include <stdio.h>
#include <string.h>
#include "esp_netif.h"
#include "esp_netif_net_stack.h"
#include "esp_compiler.h"
#include "netif/esp_pbuf_ref.h"
typedef struct wifi_custom_pbuf
{
struct pbuf_custom p;
void* l2_buf;
} wifi_custom_pbuf_t;
static struct netif *s_wifi_netifs[2] = { NULL };
/**
* In this function, the hardware should be initialized.
* Called from wlanif_input().
*
* @param netif the already initialized lwip network interface structure
* for this wlanif
*/
static void
low_level_init(struct netif *netif)
{
/* set MAC hardware address length */
netif->hwaddr_len = ETHARP_HWADDR_LEN;
/* set MAC hardware address */
/* maximum transfer unit */
netif->mtu = 1500;
/* device capabilities */
/* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;
#if ESP_LWIP
#if LWIP_IGMP
netif->flags |= NETIF_FLAG_IGMP;
#endif
#endif
#if ESP_IPV6
#if LWIP_IPV6 && LWIP_IPV6_MLD
netif->flags |= NETIF_FLAG_MLD6;
#endif
#endif
}
err_t set_wifi_netif(int wifi_inx, void* netif)
{
if (wifi_inx < 2) {
s_wifi_netifs[wifi_inx] = netif;
return ERR_OK;
}
return ERR_ARG;
}
static void wifi_pbuf_free(struct pbuf *p)
{
wifi_custom_pbuf_t* wifi_pbuf = (wifi_custom_pbuf_t*)p;
if (wifi_pbuf) {
esp_wifi_internal_free_rx_buffer(wifi_pbuf->l2_buf);
}
mem_free(wifi_pbuf);
}
static inline struct pbuf* wifi_pbuf_allocate(struct netif *netif, void *buffer, size_t len, void *l2_buff)
{
struct pbuf *p;
wifi_custom_pbuf_t* esp_pbuf = mem_malloc(sizeof(wifi_custom_pbuf_t));
if (esp_pbuf == NULL) {
return NULL;
}
esp_pbuf->p.custom_free_function = wifi_pbuf_free;
esp_pbuf->l2_buf = l2_buff;
p = pbuf_alloced_custom(PBUF_RAW, len, PBUF_REF, &esp_pbuf->p, buffer, len);
if (p == NULL) {
mem_free(esp_pbuf);
return NULL;
}
return p;
}
esp_err_t wifi_rxcb_sta(void *buffer, uint16_t len, void *l2_buff)
{
struct netif * netif = s_wifi_netifs[0];
struct pbuf *p;
if(unlikely(!buffer || !netif_is_up(netif))) {
if (l2_buff) {
esp_wifi_internal_free_rx_buffer(l2_buff);
}
return ESP_FAIL;
}
p = wifi_pbuf_allocate(netif, buffer, len, l2_buff);
if (p == NULL) {
esp_wifi_internal_free_rx_buffer(l2_buff);
return ESP_FAIL;
}
/* full packet send to tcpip_thread to process */
if (unlikely(netif->input(p, netif) != ERR_OK)) {
LWIP_DEBUGF(NETIF_DEBUG, ("wlanif_input: IP input error\n"));
pbuf_free(p);
}
return ESP_OK;
}
esp_err_t wifi_rxcb_ap(void *buffer, uint16_t len, void *l2_buff)
{
struct netif * netif = s_wifi_netifs[1];
struct pbuf *p;
if(unlikely(!buffer || !netif_is_up(netif))) {
if (l2_buff) {
esp_wifi_internal_free_rx_buffer(l2_buff);
}
return ESP_FAIL;
}
p = wifi_pbuf_allocate(netif, buffer, len, l2_buff);
if (p == NULL) {
esp_wifi_internal_free_rx_buffer(l2_buff);
return ESP_FAIL;
}
/* full packet send to tcpip_thread to process */
if (unlikely(netif->input(p, netif) != ERR_OK)) {
LWIP_DEBUGF(NETIF_DEBUG, ("wlanif_input: IP input error\n"));
pbuf_free(p);
}
return ESP_OK;
}
/**
* This function should be called when a packet is ready to be read
* from the interface. It uses the function low_level_input() that
* should handle the actual reception of bytes from the network
* interface. Then the type of the received packet is determined and
* the appropriate input function is called.
*
* @param h lwip network interface structure (struct netif) for this ethernetif
* @param buffer wlan buffer
* @param len length of buffer
* @param l2_buff wlan's L2 buffer pointer
*/
void
wlanif_input(void *h, void *buffer, size_t len, void* l2_buff)
{
struct netif * netif = h;
esp_netif_t *esp_netif = esp_netif_get_handle_from_netif_impl(netif);
struct pbuf *p;
if(unlikely(!buffer || !netif_is_up(netif))) {
if (l2_buff) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
}
return;
}
#ifdef CONFIG_LWIP_L2_TO_L3_COPY
p = pbuf_alloc(PBUF_RAW, len, PBUF_RAM);
if (p == NULL) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
return;
}
memcpy(p->payload, buffer, len);
esp_netif_free_rx_buffer(esp_netif, l2_buff);
#else
p = esp_pbuf_allocate(esp_netif, buffer, len, l2_buff);
if (p == NULL) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
return;
}
#endif
/* full packet send to tcpip_thread to process */
if (unlikely(netif->input(p, netif) != ERR_OK)) {
LWIP_DEBUGF(NETIF_DEBUG, ("wlanif_input: IP input error\n"));
pbuf_free(p);
}
}
/**
* This function should do the actual transmission of the packet. The packet is
* contained in the pbuf that is passed to the function. This pbuf
* might be chained.
*
* @param netif the lwip network interface structure for this wlanif
* @param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
* @return ERR_OK if the packet could be sent
* an err_t value if the packet couldn't be sent
*
* @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
* strange results. You might consider waiting for space in the DMA queue
* to become available since the stack doesn't retry to send a packet
* dropped because of memory failure (except for the TCP timers).
*/
static err_t
sta_output(struct netif *netif, struct pbuf *p)
{
struct pbuf *q = p;
esp_err_t ret;
if(q->next == NULL) {
ret = esp_wifi_internal_tx(WIFI_IF_STA, q->payload, q->len);
} else {
LWIP_DEBUGF(PBUF_DEBUG, ("low_level_output: pbuf is a list, application may has bug"));
q = pbuf_alloc(PBUF_RAW_TX, p->tot_len, PBUF_RAM);
if (q != NULL) {
pbuf_copy(q, p);
} else {
return ERR_MEM;
}
ret = esp_wifi_internal_tx(WIFI_IF_STA, q->payload, q->len);
pbuf_free(q);
}
if (ret == ESP_OK) {
return ERR_OK;
} else if (ret == ESP_ERR_NO_MEM) {
return ERR_MEM;
} else if (ret == ESP_ERR_INVALID_ARG) {
return ERR_ARG;
} else {
return ERR_IF;
}
}
static err_t
ap_output(struct netif *netif, struct pbuf *p)
{
struct pbuf *q = p;
esp_err_t ret;
if(q->next == NULL) {
ret = esp_wifi_internal_tx(WIFI_IF_AP, q->payload, q->len);
} else {
LWIP_DEBUGF(PBUF_DEBUG, ("low_level_output: pbuf is a list, application may has bug"));
q = pbuf_alloc(PBUF_RAW_TX, p->tot_len, PBUF_RAM);
if (q != NULL) {
pbuf_copy(q, p);
} else {
return ERR_MEM;
}
ret = esp_wifi_internal_tx(WIFI_IF_AP, q->payload, q->len);
pbuf_free(q);
}
if (ret == ESP_OK) {
return ERR_OK;
} else if (ret == ESP_ERR_NO_MEM) {
return ERR_MEM;
} else if (ret == ESP_ERR_INVALID_ARG) {
return ERR_ARG;
} else {
return ERR_IF;
}
}
/**
* Should be called at the beginning of the program to set up the
* network interface. It calls the function low_level_init() to do the
* actual setup of the hardware.
*
* This function should be passed as a parameter to netif_add().
*
* @param netif the lwip network interface structure for this wlanif
* @return ERR_OK if the loopif is initialized
* ERR_MEM if private data couldn't be allocated
* any other err_t on error
*/
err_t
wlanif_init(struct netif *netif)
{
LWIP_ASSERT("netif != NULL", (netif != NULL));
#if LWIP_NETIF_HOSTNAME
/* Initialize interface hostname */
#if ESP_LWIP
if (esp_netif_get_hostname(esp_netif_get_handle_from_netif_impl(netif), &netif->hostname) != ESP_OK) {
netif->hostname = CONFIG_LWIP_LOCAL_HOSTNAME;
}
#else
netif->hostname = "lwip";
#endif
#endif /* LWIP_NETIF_HOSTNAME */
/*
* Initialize the snmp variables and counters inside the struct netif.
* The last argument should be replaced with your link speed, in units
* of bits per second.
*/
NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, 100);
/* We directly use etharp_output() here to save a function call.
* You can instead declare your own function an call etharp_output()
* from it if you have to do some checks before sending (e.g. if link
* is available...) */
netif->output = etharp_output;
#if LWIP_IPV6
netif->output_ip6 = ethip6_output;
#endif /* LWIP_IPV6 */
/* initialize the hardware */
low_level_init(netif);
return ERR_OK;
}
err_t wlanif_init_sta(struct netif *netif) {
netif->name[0] = 's';
netif->name[1] = 't';
netif->linkoutput = sta_output;
return wlanif_init(netif);
}
err_t wlanif_init_ap(struct netif *netif) {
netif->name[0] = 'a';
netif->name[1] = 'p';
netif->linkoutput = ap_output;
return wlanif_init(netif);
}

View File

@@ -119,9 +119,6 @@ idf_component_get_property(mbedtls_dir mbedtls COMPONENT_DIR)
target_link_libraries(${COMPONENT_LIB} PUBLIC mocks) target_link_libraries(${COMPONENT_LIB} PUBLIC mocks)
else() else()
idf_component_get_property(http_parser_lib http_parser COMPONENT_LIB) idf_component_optional_requires(PUBLIC esp_event tcp_transport)
idf_component_get_property(tcp_transport_lib tcp_transport COMPONENT_LIB) idf_component_optional_requires(PRIVATE http_parser)
idf_component_get_property(lwip_lib lwip COMPONENT_LIB)
target_link_libraries(${COMPONENT_LIB} PUBLIC ${http_parser_lib} ${tcp_transport_lib})
target_link_libraries(${COMPONENT_LIB} PRIVATE ${lwip_lib})
endif() endif()

View File

@@ -1,2 +1,2 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_REQUIRES cmock test_utils mqtt nvs_flash app_update esp_eth) PRIV_REQUIRES cmock test_utils mqtt nvs_flash app_update esp_eth esp_netif)

View File

@@ -1,16 +1,8 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD /*
// * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
#pragma once #pragma once
@@ -23,6 +15,31 @@
extern "C" { extern "C" {
#endif #endif
/**
* @brief Default configuration reference of OT esp-netif
*/
#define ESP_NETIF_INHERENT_DEFAULT_OPENTHREAD() \
{ \
.flags = 0, \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(mac) \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(ip_info) \
.get_ip_event = 0, \
.lost_ip_event = 0, \
.if_key = "OT_DEF", \
.if_desc = "openthread", \
.route_prio = 15 \
};
#define ESP_NETIF_DEFAULT_OPENTHREAD() \
{ \
.base = &g_esp_netif_inherent_openthread_config, \
.driver = NULL, \
.stack = &g_esp_netif_netstack_default_openthread, \
}
extern const esp_netif_netstack_config_t g_esp_netif_netstack_default_openthread;
extern const esp_netif_inherent_config_t g_esp_netif_inherent_openthread_config;
/** /**
* @brief This function initializes the OpenThread network interface glue. * @brief This function initializes the OpenThread network interface glue.
* *

View File

@@ -1,3 +1,3 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "." PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES cmock test_utils spiffs) PRIV_REQUIRES cmock test_utils spiffs vfs)

View File

@@ -22,4 +22,4 @@ idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS include INCLUDE_DIRS include
PRIV_INCLUDE_DIRS src proto-c ../protocomm/proto-c PRIV_INCLUDE_DIRS src proto-c ../protocomm/proto-c
REQUIRES lwip protocomm REQUIRES lwip protocomm
PRIV_REQUIRES protobuf-c bt json esp_timer) PRIV_REQUIRES protobuf-c bt json esp_timer esp_wifi)

View File

@@ -196,7 +196,7 @@ idf_component_register(SRCS "${srcs}" "${esp_srcs}" "${tls_src}" "${roaming_src}
"${crypto_src}" "${mbo_src}" "${dpp_src}" "${wps_registrar_src}" "${crypto_src}" "${mbo_src}" "${dpp_src}" "${wps_registrar_src}"
INCLUDE_DIRS include port/include esp_supplicant/include INCLUDE_DIRS include port/include esp_supplicant/include
PRIV_INCLUDE_DIRS src src/utils esp_supplicant/src src/crypto PRIV_INCLUDE_DIRS src src/utils esp_supplicant/src src/crypto
PRIV_REQUIRES mbedtls esp_timer) PRIV_REQUIRES mbedtls esp_timer esp_wifi)
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-strict-aliasing -Wno-write-strings -Werror) target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-strict-aliasing -Wno-write-strings -Werror)
target_compile_definitions(${COMPONENT_LIB} PRIVATE target_compile_definitions(${COMPONENT_LIB} PRIVATE

View File

@@ -1,7 +1,7 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}" PRIV_INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}"
PRIV_INCLUDE_DIRS "../src" "../esp_supplicant/src" PRIV_INCLUDE_DIRS "../src" "../esp_supplicant/src"
PRIV_REQUIRES cmock esp_common test_utils wpa_supplicant mbedtls) PRIV_REQUIRES cmock esp_common test_utils wpa_supplicant mbedtls esp_wifi esp_event)
idf_component_get_property(esp_supplicant_dir wpa_supplicant COMPONENT_DIR) idf_component_get_property(esp_supplicant_dir wpa_supplicant COMPONENT_DIR)

View File

@@ -14,7 +14,7 @@ endif()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include" INCLUDE_DIRS "include"
PRIV_REQUIRES esp_netif driver) PRIV_REQUIRES esp_netif driver esp_wifi vfs)
if(CONFIG_EXAMPLE_PROVIDE_WIFI_CONSOLE_CMD) if(CONFIG_EXAMPLE_PROVIDE_WIFI_CONSOLE_CMD)
idf_component_optional_requires(PRIVATE console) idf_component_optional_requires(PRIVATE console)

View File

@@ -1,8 +0,0 @@
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/cxx/experimental/experimental_cpp_component)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(simple_cxx_ppp_client)

View File

@@ -1,62 +0,0 @@
| Supported Targets | ESP32 | ESP32-S2 |
| ----------------- | ----- | -------- |
# Simple example of esp_modem component
(See the README.md file in the upper level 'examples' directory for more information about examples.)
## Overview
This example demonstrates the use of the [esp-modem component](https://components.espressif.com/component/espressif/esp_modem) to connect to a network and send some AT commands.
It uses modem CMUX mode so that commands and network could be used at the same time.
## About the esp_modem
The esp_modem component is deployed automatically when building this example. It will be located inside this example directory, in relative path `managed_components/espressif__esp_modem`.
You can find a brief introduction in the root directory of the component, in the main `README.md` for or a full html documentation in the relative path `docs/html/index.html`.
## How to use example
### Hardware Required
To run this example, you need an ESP32 dev board connected to a GSM/4G cellular module, which supports AT commands and PPP connectivity.
The example uses UART to communicate with the modem and it uses the below pin assignment:
| ESP32 | Cellular Modem |
| ------ | -------------- |
| GPIO25 | RX |
| GPIO26 | TX |
| GND | GND |
### Configure the project
* Choose the modem module in `Choose supported modem device(DCE)` option.
* Set the access point name in `Set Access Point Name(APN)` option, which should depend on the operator of your SIM card.
* Enable `EXAMPLE_NEED_SIM_PIN`: To unlock the SIM card with a PIN code if needed
## Example Output
The example will unlock the SIM card (if enabled) and enter the CMUX mode.
Then it would initiate the connection to a public MQTT broker and at the same time reading some data using AT commands.
```
I (571) uart: queue free spaces: 30
I (1731) cmux_example: Modem has correctly entered multiplexed command/data mode
I (2241) cmux_example: Operator name: "OperatorName"
I (7781) esp-netif_lwip-ppp: Connected
I (7781) esp-netif_lwip-ppp: Name Server1: xxx.xxx.xxx.xxx
I (7781) esp-netif_lwip-ppp: Name Server2: xxx.xxx.xxx.xxx
I (7781) cmux_example: Got IP address
I (7791) cmux_example: IP : xxx.xxx.xxx.xxx
I (7791) cmux_example: Netmask : xxx.xxx.xxx.xxx
I (7801) cmux_example: Gateway : xxx.xxx.xxx.xxx
I (7801) system_api: Base MAC address is not set
I (7811) system_api: read default base MAC address from EFUSE
I (9061) cmux_example: TOPIC: /topic/esp-modem
I (9061) cmux_example: DATA: Hello modem
I (9061) cmux_example: Data received
I (9211) cmux_example: Modem IMSI number: xxxxxxxxxxxxxxxx
I (21221) esp-netif_lwip-ppp: User interrupt
I (21221) esp_modem_netif: PPP state changed event 5
```

View File

@@ -1,2 +0,0 @@
idf_component_register(SRCS "simple_client.cpp" "simple_mqtt_client.cpp"
INCLUDE_DIRS ".")

View File

@@ -1,42 +0,0 @@
menu "Example Configuration"
choice EXAMPLE_MODEM_DEVICE
prompt "Choose supported modem device (DCE)"
default EXAMPLE_MODEM_DEVICE_BG96
help
Select modem device connected to the ESP DTE.
config EXAMPLE_MODEM_DEVICE_SIM800
bool "SIM800"
help
SIMCom SIM800L is a GSM/GPRS module.
It supports Quad-band 850/900/1800/1900MHz.
config EXAMPLE_MODEM_DEVICE_BG96
bool "BG96"
help
Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module.
config EXAMPLE_MODEM_DEVICE_SIM7600
bool "SIM7600"
help
SIM7600 is a Multi-Band LTE-TDD/LTE-FDD/HSPA+ and GSM/GPRS/EDGE module.
endchoice
config EXAMPLE_MODEM_PPP_APN
string "Set MODEM APN"
default "internet"
help
Set APN (Access Point Name), a logical name to choose data network
config EXAMPLE_NEED_SIM_PIN
bool "SIM PIN needed"
default n
help
Enable to set SIM PIN before starting the example
config EXAMPLE_SIM_PIN
string "Set SIM PIN"
default "1234"
depends on EXAMPLE_NEED_SIM_PIN
help
Pin to unlock the SIM
endmenu

View File

@@ -1,6 +0,0 @@
targets:
- esp32
- esp32s2
description: cmux example of esp_modem
dependencies:
espressif/esp_modem: "~0.1.12"

View File

@@ -1,137 +0,0 @@
/* PPPoS Client Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <cstring>
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "esp_netif.h"
#include "esp_log.h"
#include "cxx_include/esp_modem_dte.hpp"
#include "esp_modem_config.h"
#include "cxx_include/esp_modem_api.hpp"
#include "esp_event_cxx.hpp"
#include "simple_mqtt_client.hpp"
#define BROKER_URL "mqtt://mqtt.eclipseprojects.io"
using namespace esp_modem;
using namespace idf::event;
constexpr auto TAG = "cmux_example";
extern "C" void app_main(void)
{
/* Init and register system/core components */
auto loop = std::make_shared<ESPEventLoop>();
ESP_ERROR_CHECK(esp_netif_init());
/* Configure the DTE */
esp_modem_dte_config_t dte_config = ESP_MODEM_DTE_DEFAULT_CONFIG();
/* Configure the DCE */
esp_modem_dce_config_t dce_config = ESP_MODEM_DCE_DEFAULT_CONFIG(CONFIG_EXAMPLE_MODEM_PPP_APN);
/* Configure the PPP netif */
esp_netif_config_t netif_ppp_config = ESP_NETIF_DEFAULT_PPP();
/* Create the DTE, PPP and DCE objects */
auto uart_dte = create_uart_dte(&dte_config);
assert(uart_dte);
esp_netif_t *esp_netif = esp_netif_new(&netif_ppp_config);
assert(esp_netif);
#if CONFIG_EXAMPLE_MODEM_DEVICE_BG96 == 1
std::unique_ptr<DCE> dce = create_BG96_dce(&dce_config, uart_dte, esp_netif);
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM800 == 1
std::unique_ptr<DCE> dce = create_SIM800_dce(&dce_config, uart_dte, esp_netif);
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1
std::unique_ptr<DCE> dce = create_SIM7600_dce(&dce_config, uart_dte, esp_netif);
#else
#error "Unsupported device"
#endif
assert(dce);
/* Setup basic operation mode for the DCE (pin if used, CMUX mode) */
#if CONFIG_EXAMPLE_NEED_SIM_PIN == 1
bool pin_ok = true;
if (dce->read_pin(pin_ok) == command_result::OK && !pin_ok) {
if (dce->set_pin(CONFIG_EXAMPLE_SIM_PIN) == command_result::OK) {
vTaskDelay(pdMS_TO_TICKS(1000)); // Need to wait for some time after unlocking the SIM
} else {
ESP_LOGE(TAG, "Failed to set PIN... exiting");
return;
}
}
#endif
if (dce->set_mode(esp_modem::modem_mode::CMUX_MODE) && dce->set_mode(esp_modem::modem_mode::DATA_MODE)) {
ESP_LOGI(TAG, "Modem has correctly entered multiplexed command/data mode");
} else {
ESP_LOGE(TAG, "Failed to configure desired mode... exiting");
return;
}
/* Read some data from the modem */
std::string str;
while (dce->get_operator_name(str) != esp_modem::command_result::OK) {
// Getting operator name could fail... retry after 500 ms
vTaskDelay(pdMS_TO_TICKS(500));
}
ESP_LOGI(TAG, "Operator name: %s", str.c_str());
/* Try to connect to the network and publish an mqtt topic */
ESPEventHandlerSync event_handler(loop);
event_handler.listen_to(ESPEvent(IP_EVENT, ESPEventID(ESP_EVENT_ANY_ID)));
auto result = event_handler.wait_event_for(std::chrono::milliseconds(60000));
if (result.timeout) {
ESP_LOGE(TAG, "Cannot get IP within specified timeout... exiting");
return;
} else if (result.event.id == ESPEventID(IP_EVENT_PPP_GOT_IP)) {
auto *event = (ip_event_got_ip_t *)result.ev_data;
ESP_LOGI(TAG, "Got IP address");
ESP_LOGI(TAG, "IP : " IPSTR, IP2STR(&event->ip_info.ip));
ESP_LOGI(TAG, "Netmask : " IPSTR, IP2STR(&event->ip_info.netmask));
ESP_LOGI(TAG, "Gateway : " IPSTR, IP2STR(&event->ip_info.gw));
/* When connected to network, subscribe and publish some MQTT data */
MqttClient mqtt(BROKER_URL);
event_handler.listen_to(MqttClient::get_event(MqttClient::Event::CONNECT));
event_handler.listen_to(MqttClient::get_event(MqttClient::Event::DATA));
auto reg = loop->register_event(MqttClient::get_event(MqttClient::Event::DATA),
[&mqtt](const ESPEvent &event, void *data) {
ESP_LOGI(TAG, " TOPIC: %s", mqtt.get_topic(data).c_str());
ESP_LOGI(TAG, " DATA: %s", mqtt.get_data(data).c_str());
});
mqtt.connect();
while (true) {
result = event_handler.wait_event_for(std::chrono::milliseconds(60000));
if (result.event == MqttClient::get_event(MqttClient::Event::CONNECT)) {
mqtt.subscribe("/topic/esp-modem");
mqtt.publish("/topic/esp-modem", "Hello modem");
continue;
} else if (result.event == MqttClient::get_event(MqttClient::Event::DATA)) {
ESP_LOGI(TAG, "Data received");
break; /* Continue with CMUX example after getting data from MQTT */
} else {
break;
}
}
} else if (result.event.id == ESPEventID(IP_EVENT_PPP_LOST_IP)) {
ESP_LOGE(TAG, "PPP client has lost connection... exiting");
return;
}
/* Again reading some data from the modem */
if (dce->get_imsi(str) == esp_modem::command_result::OK) {
ESP_LOGI(TAG, "Modem IMSI number: %s", str.c_str());
}
}

View File

@@ -1,101 +0,0 @@
/* PPPoS Client Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <memory>
#include "mqtt_client.h"
#include "esp_event_cxx.hpp"
#include "simple_mqtt_client.hpp"
using namespace idf::event;
/**
* Reference to the MQTT event base
*/
ESP_EVENT_DECLARE_BASE(MQTT_EVENTS);
/**
* Thin wrapper around C mqtt_client
*/
struct MqttClientHandle
{
explicit MqttClientHandle(const std::string & uri)
{
esp_mqtt_client_config_t config = { };
config.broker.address.uri = uri.c_str();
client = esp_mqtt_client_init(&config);
esp_mqtt_client_register_event(client, MQTT_EVENT_ANY, mqtt_event_handler, this);
}
~MqttClientHandle()
{
esp_mqtt_client_destroy(client);
}
static void mqtt_event_handler(void *args, esp_event_base_t base, int32_t id, void *data)
{
// forwards the internal event to the global ESPEvent
esp_event_post(base, id, data, sizeof(esp_mqtt_event_t), portMAX_DELAY);
}
esp_mqtt_client_handle_t client;
};
/**
* @brief Definitions of MqttClient methods
*/
MqttClient::MqttClient(const std::string & uri):
h(std::unique_ptr<MqttClientHandle>(new MqttClientHandle(uri)))
{}
void MqttClient::connect()
{
esp_mqtt_client_start(h->client);
}
idf::event::ESPEvent MqttClient::get_event(MqttClient::Event ev)
{
switch (ev) {
case Event::CONNECT: {
return { MQTT_EVENTS, ESPEventID(MQTT_EVENT_CONNECTED) };
}
case Event::DATA:
return { MQTT_EVENTS, ESPEventID(MQTT_EVENT_DATA) };
}
return { };
}
int MqttClient::publish(const std::string &topic, const std::string &data, int qos)
{
return esp_mqtt_client_publish(h->client, topic.c_str(), data.c_str(), 0, qos, 0);
}
int MqttClient::subscribe(const std::string &topic, int qos)
{
return esp_mqtt_client_subscribe(h->client, topic.c_str(), qos);
}
std::string MqttClient::get_topic(void * event_data)
{
auto event = (esp_mqtt_event_handle_t)event_data;
if (event == nullptr || event->client != h->client)
return {};
return std::string(event->topic, event->topic_len);
}
std::string MqttClient::get_data(void * event_data)
{
auto event = (esp_mqtt_event_handle_t)event_data;
if (event == nullptr || event->client != h->client)
return {};
return std::string(event->data, event->data_len);
}
MqttClient::~MqttClient() = default;

View File

@@ -1,77 +0,0 @@
/* PPPoS Client Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#ifndef _SIMPLE_MQTT_CLIENT_H_
#define _SIMPLE_MQTT_CLIENT_H_
#include <string>
#include <memory>
#include "esp_event_cxx.hpp"
struct MqttClientHandle;
/**
* @brief Simple MQTT client wrapper
*/
class MqttClient {
public:
enum class Event {
CONNECT,
DATA,
};
explicit MqttClient(const std::string & uri);
~MqttClient();
/**
* @brief Start the mqtt-client
*/
void connect();
/**
* @brief Publish to topic
* @param topic Topic to publish
* @param data Data to publish
* @param qos QoS (0 by default)
* @return message id
*/
int publish(const std::string & topic, const std::string & data, int qos = 0);
/**
* @brief Subscribe to a topic
* @param topic Topic to subscribe
* @param qos QoS (0 by default)
* @return message id
*/
int subscribe(const std::string & topic, int qos = 0);
/**
* @brief Get topic from event data
* @return String topic
*/
std::string get_topic(void *);
/**
* @brief Get published data from event
* @return String representation of the data
*/
std::string get_data(void *);
/**
* @brief Convert internal MQTT event to standard ESPEvent
* @param ev internal mqtt event
* @return corresponding ESPEvent
*/
static idf::event::ESPEvent get_event(Event ev);
private:
std::unique_ptr<MqttClientHandle> h;
};
#endif //_SIMPLE_MQTT_CLIENT_H_

View File

@@ -1,8 +0,0 @@
# Override some defaults to enable PPP
CONFIG_LWIP_PPP_SUPPORT=y
CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y
CONFIG_LWIP_PPP_PAP_SUPPORT=y
CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=4096
# Do not enable IPV6 in dte<->dce link local
CONFIG_LWIP_PPP_ENABLE_IPV6=n
CONFIG_COMPILER_CXX_EXCEPTIONS=y

View File

@@ -6,4 +6,4 @@ set(sources src/msc_scsi_bot.c
idf_component_register( SRCS ${sources} idf_component_register( SRCS ${sources}
INCLUDE_DIRS include INCLUDE_DIRS include
PRIV_INCLUDE_DIRS private_include PRIV_INCLUDE_DIRS private_include
REQUIRES usb fatfs ) REQUIRES usb fatfs vfs )

View File

@@ -1,3 +1,3 @@
idf_component_register(SRCS "msc_example_main.c" idf_component_register(SRCS "msc_example_main.c"
INCLUDE_DIRS "" INCLUDE_DIRS ""
REQUIRES usb msc fatfs) REQUIRES usb msc fatfs vfs)

View File

@@ -14,6 +14,7 @@
#include <sys/param.h> #include <sys/param.h>
#include "esp_netif.h" #include "esp_netif.h"
#include "esp_eth.h" #include "esp_eth.h"
#include "esp_wifi.h"
#include "protocol_examples_common.h" #include "protocol_examples_common.h"
#include "lwip/sockets.h" #include "lwip/sockets.h"
#include <esp_https_server.h> #include <esp_https_server.h>

View File

@@ -62,6 +62,7 @@ examples_and_unit_tests:
lwip_component: lwip_component:
include: include:
- 'components/lwip/**' - 'components/lwip/**'
- 'components/esp_netif/lwip/**'
allowed_licenses: allowed_licenses:
- Apache-2.0 - Apache-2.0
- BSD-3-Clause - BSD-3-Clause

View File

@@ -461,8 +461,6 @@ components/esp_local_ctrl/src/esp_local_ctrl_priv.h
components/esp_local_ctrl/src/esp_local_ctrl_transport_ble.c components/esp_local_ctrl/src/esp_local_ctrl_transport_ble.c
components/esp_netif/include/esp_netif_ppp.h components/esp_netif/include/esp_netif_ppp.h
components/esp_netif/include/esp_netif_slip.h components/esp_netif/include/esp_netif_slip.h
components/esp_netif/loopback/esp_netif_loopback.c
components/esp_netif/lwip/esp_netif_lwip_slip.c
components/esp_netif/lwip/esp_netif_lwip_slip.h components/esp_netif/lwip/esp_netif_lwip_slip.h
components/esp_netif/private_include/esp_netif_private.h components/esp_netif/private_include/esp_netif_private.h
components/esp_netif/test/test_esp_netif.c components/esp_netif/test/test_esp_netif.c
@@ -681,7 +679,6 @@ components/esp_wifi/include/esp_mesh_internal.h
components/esp_wifi/include/esp_private/esp_wifi_types_private.h components/esp_wifi/include/esp_private/esp_wifi_types_private.h
components/esp_wifi/include/esp_private/wifi_types.h components/esp_wifi/include/esp_private/wifi_types.h
components/esp_wifi/include/esp_smartconfig.h components/esp_wifi/include/esp_smartconfig.h
components/esp_wifi/include/esp_wifi_netif.h
components/esp_wifi/include/smartconfig_ack.h components/esp_wifi/include/smartconfig_ack.h
components/esp_wifi/src/lib_printf.c components/esp_wifi/src/lib_printf.c
components/esp_wifi/src/mesh_event.c components/esp_wifi/src/mesh_event.c
@@ -873,7 +870,6 @@ components/lwip/port/esp32/include/netinet/in.h
components/lwip/port/esp32/include/netinet/tcp.h components/lwip/port/esp32/include/netinet/tcp.h
components/lwip/port/esp32/include/sntp/sntp_get_set_time.h components/lwip/port/esp32/include/sntp/sntp_get_set_time.h
components/lwip/port/esp32/include/sys/socket.h components/lwip/port/esp32/include/sys/socket.h
components/lwip/port/esp32/netif/ethernetif.c
components/lwip/port/esp32/no_vfs_syscalls.c components/lwip/port/esp32/no_vfs_syscalls.c
components/lwip/test_afl_host/dhcp_di.h components/lwip/test_afl_host/dhcp_di.h
components/lwip/test_afl_host/dhcpserver_di.h components/lwip/test_afl_host/dhcpserver_di.h
@@ -957,7 +953,6 @@ components/nvs_flash/test_nvs_host/test_nvs_partition.cpp
components/nvs_flash/test_nvs_host/test_nvs_storage.cpp components/nvs_flash/test_nvs_host/test_nvs_storage.cpp
components/openthread/include/esp_openthread.h components/openthread/include/esp_openthread.h
components/openthread/include/esp_openthread_lock.h components/openthread/include/esp_openthread_lock.h
components/openthread/include/esp_openthread_netif_glue.h
components/protocomm/include/transports/protocomm_console.h components/protocomm/include/transports/protocomm_console.h
components/protocomm/include/transports/protocomm_httpd.h components/protocomm/include/transports/protocomm_httpd.h
components/protocomm/proto-c/constants.pb-c.c components/protocomm/proto-c/constants.pb-c.c