2019-06-28 10:47:34 -04:00
|
|
|
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
2016-08-17 11:08:22 -04:00
|
|
|
//
|
|
|
|
// 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.
|
2019-09-13 09:44:23 -04:00
|
|
|
#ifndef _ESP_NETIF_SUPPRESS_LEGACY_WARNING_
|
|
|
|
#warning "This header is deprecated, please use new network related API in esp_netif.h"
|
|
|
|
#include "esp_netif.h"
|
|
|
|
#endif
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
#ifndef _TCPIP_ADAPTER_H_
|
|
|
|
#define _TCPIP_ADAPTER_H_
|
|
|
|
|
2019-09-02 05:22:09 -04:00
|
|
|
#include "esp_netif.h"
|
2019-09-13 09:44:23 -04:00
|
|
|
|
2019-09-02 05:22:09 -04:00
|
|
|
#include "tcpip_adapter_types.h"
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2019-11-26 18:20:41 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-09-28 04:21:24 -04:00
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief tcpip adapter legacy init. It is used only to set the compatibility mode of esp-netif, which
|
|
|
|
* will enable backward compatibility of esp-netif.
|
2016-09-28 04:21:24 -04:00
|
|
|
*/
|
2019-09-13 09:44:23 -04:00
|
|
|
void tcpip_adapter_init(void) __attribute__ ((deprecated));
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-28 04:21:24 -04:00
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief Compatiblity mode: convert the esp-netif handle to tcpip_adapter legacy interface enum
|
2018-12-03 02:11:53 -05:00
|
|
|
*
|
2019-06-28 10:47:34 -04:00
|
|
|
* @param esp_netif
|
2016-09-28 04:21:24 -04:00
|
|
|
*
|
2019-06-28 10:47:34 -04:00
|
|
|
* @return corresponding interface if valid or known esp_netif provided, TCPIP_ADAPTER_IF_MAX otherwise
|
2016-09-28 04:21:24 -04:00
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
tcpip_adapter_if_t tcpip_adapter_if_from_esp_netif(esp_netif_t *esp_netif);
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-28 04:21:24 -04:00
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief Translates to esp_netif_get_ip_info
|
2018-12-03 02:11:53 -05:00
|
|
|
*
|
2019-06-28 10:47:34 -04:00
|
|
|
* @param tcpip_if Interface type corresponding to appropriate instance of esp-netif
|
|
|
|
* @param ip_info See esp_netif_get_ip_info
|
|
|
|
* @return See esp_netif_get_ip_info
|
2016-09-28 04:21:24 -04:00
|
|
|
*/
|
2016-09-06 01:02:02 -04:00
|
|
|
esp_err_t tcpip_adapter_get_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info);
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2021-01-18 06:14:51 -05:00
|
|
|
#if CONFIG_LWIP_IPV6
|
2016-09-28 04:21:24 -04:00
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief Translates to esp_netif_get_ip6_linklocal
|
2016-09-28 04:21:24 -04:00
|
|
|
*
|
2019-06-28 10:47:34 -04:00
|
|
|
* @param tcpip_if Interface type corresponding to appropriate instance of esp-netif
|
|
|
|
* @param if_ip6 See esp_netif_get_ip6_linklocal
|
|
|
|
* @return See esp_netif_get_ip6_linklocal
|
2016-11-09 22:24:31 -05:00
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_get_ip6_linklocal(tcpip_adapter_if_t tcpip_if, ip6_addr_t *if_ip6);
|
|
|
|
|
2019-11-26 21:34:00 -05:00
|
|
|
/**
|
|
|
|
* @brief Translates to esp_netif_get_ip6_global
|
|
|
|
*
|
|
|
|
* @param tcpip_if Interface type corresponding to appropriate instance of esp-netif
|
|
|
|
* @param if_ip6 See esp_netif_get_ip6_global
|
|
|
|
* @return See esp_netif_get_ip6_global
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_get_ip6_global(tcpip_adapter_if_t tcpip_if, ip6_addr_t *if_ip6);
|
2021-01-18 06:14:51 -05:00
|
|
|
#endif
|
2019-11-26 21:34:00 -05:00
|
|
|
|
2016-09-28 04:21:24 -04:00
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief`Translates to esp_netif_dhcpc_get_status
|
|
|
|
* @param tcpip_if Interface type corresponding to appropriate instance of esp-netif
|
|
|
|
* @param status
|
|
|
|
* @return See esp_netif_dhcpc_get_status
|
2016-09-28 04:21:24 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t tcpip_adapter_dhcpc_get_status(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dhcp_status_t *status);
|
2016-09-28 04:21:24 -04:00
|
|
|
|
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief Translates to esp_netif_is_netif_up
|
|
|
|
* @param tcpip_if Interface type corresponding to appropriate instance of esp-netif
|
|
|
|
* @return see esp_netif_is_netif_up
|
2016-09-28 04:21:24 -04:00
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
bool tcpip_adapter_is_netif_up(tcpip_adapter_if_t tcpip_if);
|
2016-11-30 03:44:31 -05:00
|
|
|
|
2017-12-07 08:21:40 -05:00
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief Translates to esp_netif_get_netif
|
|
|
|
* @param tcpip_if Interface type corresponding to appropriate instance of esp-netif
|
|
|
|
* @param netif
|
|
|
|
* @return see esp_netif_get_netif
|
2017-12-07 08:21:40 -05:00
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_get_netif(tcpip_adapter_if_t tcpip_if, void ** netif);
|
|
|
|
|
2021-01-18 06:14:51 -05:00
|
|
|
#if CONFIG_LWIP_IPV6
|
2018-10-22 10:45:42 -04:00
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief Translates to esp_netif_create_ip6_linklocal
|
|
|
|
* @param tcpip_if Interface type corresponding to appropriate instance of esp-netif
|
|
|
|
* @return see esp_netif_create_ip6_linklocal
|
2018-10-22 10:45:42 -04:00
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_create_ip6_linklocal(tcpip_adapter_if_t tcpip_if);
|
2021-01-18 06:14:51 -05:00
|
|
|
#endif
|
2018-11-05 22:09:32 -05:00
|
|
|
|
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief Compatible version of setting ethernet default handlers
|
|
|
|
* @note Compatible version of wifi handlers are provided in a separate header,
|
|
|
|
* as this used to be called privately from wifi_init()
|
|
|
|
* @return ESP_OK on success
|
2018-11-05 22:09:32 -05:00
|
|
|
*/
|
2019-07-16 05:33:30 -04:00
|
|
|
esp_err_t tcpip_adapter_set_default_eth_handlers(void);
|
2018-11-05 22:09:32 -05:00
|
|
|
|
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief Compatible version of network stack input function. Translates to esp_netif_receive()
|
2018-11-05 22:09:32 -05:00
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_eth_input(void *buffer, uint16_t len, void *eb);
|
2018-11-05 22:09:32 -05:00
|
|
|
|
2019-10-23 10:47:16 -04:00
|
|
|
/**
|
|
|
|
* @brief Compatible version of network stack input function. Translates to esp_netif_receive()
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_sta_input(void *buffer, uint16_t len, void *eb);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of network stack input function. Translates to esp_netif_receive()
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_ap_input(void *buffer, uint16_t len, void *eb);
|
|
|
|
|
2018-11-05 22:09:32 -05:00
|
|
|
/**
|
2019-06-28 10:47:34 -04:00
|
|
|
* @brief Compatible version of former tcpip_adapter API to clear default WIFI handlers
|
|
|
|
* @return ESP_OK on success
|
2018-11-05 22:09:32 -05:00
|
|
|
*/
|
2019-07-16 05:33:30 -04:00
|
|
|
esp_err_t tcpip_adapter_clear_default_wifi_handlers(void);
|
2018-11-05 22:09:32 -05:00
|
|
|
|
2019-09-04 07:58:29 -04:00
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API to clear default ethernet handlers
|
|
|
|
* @return ESP_OK on success
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_clear_default_eth_handlers(void);
|
|
|
|
|
2019-09-02 05:22:09 -04:00
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_dhcps_stop
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_dhcps_stop(tcpip_adapter_if_t tcpip_if);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_dhcpc_stop
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_dhcpc_stop(tcpip_adapter_if_t tcpip_if);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_dhcps_start
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_dhcps_start(tcpip_adapter_if_t tcpip_if);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_dhcpc_start
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_dhcpc_start(tcpip_adapter_if_t tcpip_if);
|
2018-11-05 22:09:32 -05:00
|
|
|
|
2019-09-02 05:22:09 -04:00
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_dhcps_get_status
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_dhcps_get_status(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dhcp_status_t *status);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_dhcps_option
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_dhcps_option(tcpip_adapter_dhcp_option_mode_t opt_op, tcpip_adapter_dhcp_option_id_t opt_id, void *opt_val, uint32_t opt_len);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_dhcpc_option
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_dhcpc_option(tcpip_adapter_dhcp_option_mode_t opt_op, tcpip_adapter_dhcp_option_id_t opt_id, void *opt_val, uint32_t opt_len);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_set_ip_info
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_set_ip_info(tcpip_adapter_if_t tcpip_if, const tcpip_adapter_ip_info_t *ip_info);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_get_dns_info
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_get_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dns_type_t type, tcpip_adapter_dns_info_t *dns);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_set_dns_info
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_set_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dns_type_t type, tcpip_adapter_dns_info_t *dns);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_get_netif_impl_index
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
int tcpip_adapter_get_netif_index(tcpip_adapter_if_t tcpip_if);
|
2019-09-02 05:22:09 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_get_sta_list
|
|
|
|
*/
|
2019-06-28 10:47:34 -04:00
|
|
|
esp_err_t tcpip_adapter_get_sta_list(const wifi_sta_list_t *wifi_sta_list, tcpip_adapter_sta_list_t *tcpip_sta_list);
|
2016-09-25 15:05:25 -04:00
|
|
|
|
2019-10-23 10:47:16 -04:00
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_action_start for default ethernet
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_eth_start(uint8_t *mac, tcpip_adapter_ip_info_t *ip_info, void *args);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_action_start for default station
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_sta_start(uint8_t *mac, tcpip_adapter_ip_info_t *ip_info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_action_start for default softAP
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_ap_start(uint8_t *mac, tcpip_adapter_ip_info_t *ip_info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_action_stop
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_stop(tcpip_adapter_if_t tcpip_if);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_up
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_up(tcpip_adapter_if_t tcpip_if);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_down
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_down(tcpip_adapter_if_t tcpip_if);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_get_old_ip_info
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_get_old_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_set_old_ip_info
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_set_old_ip_info(tcpip_adapter_if_t tcpip_if, const tcpip_adapter_ip_info_t *ip_info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_get_handle_from_netif_impl
|
|
|
|
*/
|
|
|
|
esp_interface_t tcpip_adapter_get_esp_if(void *dev);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_set_hostname
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_set_hostname(tcpip_adapter_if_t tcpip_if, const char *hostname);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compatible version of former tcpip_adapter API of esp_netif_get_hostname
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_get_hostname(tcpip_adapter_if_t tcpip_if, const char **hostname);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This function is called from wifi_init to assure backward compatibility mode
|
|
|
|
* of tcpip_adapter. In case of legacy use, default instances of ap and sta
|
|
|
|
* are created and handlers are registered
|
|
|
|
*
|
|
|
|
* @return ESP_OK on success
|
|
|
|
*/
|
|
|
|
esp_err_t tcpip_adapter_set_default_wifi_handlers(void);
|
|
|
|
|
2019-11-26 18:20:41 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
2019-06-28 10:47:34 -04:00
|
|
|
#endif //_TCPIP_ADAPTER_H_
|