kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'feature/esp_tls_api_cleanup' into 'master'
esp-tls: mark esp_tls_conn_delete API as deprecated See merge request espressif/esp-idf!16647pull/8201/head
commit
6e1f534cab
|
@ -20,11 +20,6 @@ if(CONFIG_ESP_TLS_USING_WOLFSSL)
|
||||||
target_link_libraries(${COMPONENT_LIB} PUBLIC ${wolfssl})
|
target_link_libraries(${COMPONENT_LIB} PUBLIC ${wolfssl})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ESP_TLS_USE_SE)
|
|
||||||
idf_component_get_property(cryptoauthlib esp-cryptoauthlib COMPONENT_LIB)
|
|
||||||
target_link_libraries(${COMPONENT_LIB} PUBLIC ${cryptoauthlib})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Increase link multiplicity to get some lwip symbols correctly resolved by the linker
|
# Increase link multiplicity to get some lwip symbols correctly resolved by the linker
|
||||||
# due to cyclic dependencies present in IDF for lwip/esp_netif/mbedtls
|
# due to cyclic dependencies present in IDF for lwip/esp_netif/mbedtls
|
||||||
idf_component_get_property(lwip lwip COMPONENT_LIB)
|
idf_component_get_property(lwip lwip COMPONENT_LIB)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -92,11 +92,6 @@ static ssize_t tcp_write(esp_tls_t *tls, const char *data, size_t datalen)
|
||||||
/**
|
/**
|
||||||
* @brief Close the TLS connection and free any allocated resources.
|
* @brief Close the TLS connection and free any allocated resources.
|
||||||
*/
|
*/
|
||||||
void esp_tls_conn_delete(esp_tls_t *tls)
|
|
||||||
{
|
|
||||||
esp_tls_conn_destroy(tls);
|
|
||||||
}
|
|
||||||
|
|
||||||
int esp_tls_conn_destroy(esp_tls_t *tls)
|
int esp_tls_conn_destroy(esp_tls_t *tls)
|
||||||
{
|
{
|
||||||
if (tls != NULL) {
|
if (tls != NULL) {
|
||||||
|
@ -463,14 +458,14 @@ esp_tls_t *esp_tls_conn_new(const char *hostname, int hostlen, int port, const e
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
return tls;
|
return tls;
|
||||||
} else if (ret == -1) {
|
} else if (ret == -1) {
|
||||||
esp_tls_conn_delete(tls);
|
esp_tls_conn_destroy(tls);
|
||||||
ESP_LOGE(TAG, "Failed to open new connection");
|
ESP_LOGE(TAG, "Failed to open new connection");
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (ret == 0 && cfg->timeout_ms >= 0) {
|
} else if (ret == 0 && cfg->timeout_ms >= 0) {
|
||||||
size_t timeout_ticks = pdMS_TO_TICKS(cfg->timeout_ms);
|
size_t timeout_ticks = pdMS_TO_TICKS(cfg->timeout_ms);
|
||||||
uint32_t expired = xTaskGetTickCount() - start;
|
uint32_t expired = xTaskGetTickCount() - start;
|
||||||
if (expired >= timeout_ticks) {
|
if (expired >= timeout_ticks) {
|
||||||
esp_tls_conn_delete(tls);
|
esp_tls_conn_destroy(tls);
|
||||||
ESP_LOGE(TAG, "Failed to open new connection in specified timeout");
|
ESP_LOGE(TAG, "Failed to open new connection in specified timeout");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -544,7 +539,7 @@ esp_tls_t *esp_tls_conn_http_new(const char *url, const esp_tls_cfg_t *cfg)
|
||||||
get_port(url, &u), cfg, tls) == 1) {
|
get_port(url, &u), cfg, tls) == 1) {
|
||||||
return tls;
|
return tls;
|
||||||
}
|
}
|
||||||
esp_tls_conn_delete(tls);
|
esp_tls_conn_destroy(tls);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -499,11 +499,9 @@ static inline ssize_t esp_tls_conn_read(esp_tls_t *tls, void *data, size_t data
|
||||||
/**
|
/**
|
||||||
* @brief Compatible version of esp_tls_conn_destroy() to close the TLS/SSL connection
|
* @brief Compatible version of esp_tls_conn_destroy() to close the TLS/SSL connection
|
||||||
*
|
*
|
||||||
* @note This API will be removed in IDFv5.0
|
|
||||||
*
|
|
||||||
* @param[in] tls pointer to esp-tls as esp-tls handle.
|
* @param[in] tls pointer to esp-tls as esp-tls handle.
|
||||||
*/
|
*/
|
||||||
void esp_tls_conn_delete(esp_tls_t *tls);
|
void esp_tls_conn_delete(esp_tls_t *tls) __attribute__((deprecated("Please use esp_tls_conn_destroy() instead")));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Close the TLS/SSL connection and free any allocated resources.
|
* @brief Close the TLS/SSL connection and free any allocated resources.
|
||||||
|
|
|
@ -11,7 +11,7 @@ All the configuration can be specified in the ``esp_tls_cfg_t`` data structure.
|
||||||
* :cpp:func:`esp_tls_conn_new`: for opening a new TLS connection.
|
* :cpp:func:`esp_tls_conn_new`: for opening a new TLS connection.
|
||||||
* :cpp:func:`esp_tls_conn_read`: for reading from the connection.
|
* :cpp:func:`esp_tls_conn_read`: for reading from the connection.
|
||||||
* :cpp:func:`esp_tls_conn_write`: for writing into the connection.
|
* :cpp:func:`esp_tls_conn_write`: for writing into the connection.
|
||||||
* :cpp:func:`esp_tls_conn_delete`: for freeing up the connection.
|
* :cpp:func:`esp_tls_conn_destroy`: for freeing up the connection.
|
||||||
|
|
||||||
Any application layer protocol like HTTP1, HTTP2 etc can be executed on top of this layer.
|
Any application layer protocol like HTTP1, HTTP2 etc can be executed on top of this layer.
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
// Copyright 2017 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2017-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 <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
@ -280,7 +272,7 @@ void sh2lib_free(struct sh2lib_handle *hd)
|
||||||
hd->http2_sess = NULL;
|
hd->http2_sess = NULL;
|
||||||
}
|
}
|
||||||
if (hd->http2_tls) {
|
if (hd->http2_tls) {
|
||||||
esp_tls_conn_delete(hd->http2_tls);
|
esp_tls_conn_destroy(hd->http2_tls);
|
||||||
hd->http2_tls = NULL;
|
hd->http2_tls = NULL;
|
||||||
}
|
}
|
||||||
if (hd->hostname) {
|
if (hd->hostname) {
|
||||||
|
|
|
@ -159,7 +159,7 @@ static void https_get_request(esp_tls_cfg_t cfg, const char *WEB_SERVER_URL, con
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
esp_tls_conn_delete(tls);
|
esp_tls_conn_destroy(tls);
|
||||||
for (int countdown = 10; countdown >= 0; countdown--) {
|
for (int countdown = 10; countdown >= 0; countdown--) {
|
||||||
ESP_LOGI(TAG, "%d...", countdown);
|
ESP_LOGI(TAG, "%d...", countdown);
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
|
|
|
@ -72,7 +72,7 @@ static void https_get_task(void *pvParameters)
|
||||||
ESP_LOGE(TAG, "Could not connect to %s", web_urls[i]);
|
ESP_LOGE(TAG, "Could not connect to %s", web_urls[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_tls_conn_delete(tls);
|
esp_tls_conn_destroy(tls);
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2711,7 +2711,6 @@ examples/protocols/esp_local_ctrl/main/app_main.c
|
||||||
examples/protocols/esp_local_ctrl/main/esp_local_ctrl_service.c
|
examples/protocols/esp_local_ctrl/main/esp_local_ctrl_service.c
|
||||||
examples/protocols/esp_local_ctrl/scripts/esp_local_ctrl.py
|
examples/protocols/esp_local_ctrl/scripts/esp_local_ctrl.py
|
||||||
examples/protocols/esp_local_ctrl/scripts/proto_lc.py
|
examples/protocols/esp_local_ctrl/scripts/proto_lc.py
|
||||||
examples/protocols/http2_request/components/sh2lib/sh2lib.c
|
|
||||||
examples/protocols/http2_request/components/sh2lib/sh2lib.h
|
examples/protocols/http2_request/components/sh2lib/sh2lib.h
|
||||||
examples/protocols/http2_request/main/http2_request_example_main.c
|
examples/protocols/http2_request/main/http2_request_example_main.c
|
||||||
examples/protocols/http_request/main/http_request_example_main.c
|
examples/protocols/http_request/main/http_request_example_main.c
|
||||||
|
|
Ładowanie…
Reference in New Issue