feat: Expose the function to get socket descriptor from the transport

Closes https://github.com/espressif/esp-protocols/issues/636
Closes https://github.com/espressif/esp-mqtt/issues/282
This commit is contained in:
Bogdan Kolendovskyy
2024-08-20 11:17:57 +02:00
parent fb6af9e6bc
commit 872ae5211f
3 changed files with 13 additions and 17 deletions

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -73,7 +73,7 @@ esp_transport_list_handle_t esp_transport_list_init(void);
esp_err_t esp_transport_list_destroy(esp_transport_list_handle_t list);
/**
* @brief Add a transport to the list, and define a scheme to indentify this transport in the list
* @brief Add a transport to the list, and define a scheme to identify this transport in the list
*
* @param[in] list The list
* @param[in] t The Transport
@ -329,7 +329,7 @@ esp_err_t esp_transport_set_parent_transport_func(esp_transport_handle_t t, payl
* Warning: The returned pointer is valid only as long as esp_transport_handle_t exists. Once transport
* handle gets destroyed, this value (esp_tls_error_handle_t) is freed automatically.
*
* @param[in] A transport handle
* @param[in] t The transport handle
*
* @return
* - valid pointer of esp_error_handle_t
@ -354,6 +354,15 @@ esp_tls_error_handle_t esp_transport_get_error_handle(esp_transport_handle_t t);
*/
int esp_transport_get_errno(esp_transport_handle_t t);
/**
* @brief Get the underlying socket from the transport
*
* @param[in] t The transport handle
*
* @return socket descriptor
*/
int esp_transport_get_socket(esp_transport_handle_t t);
/**
* @brief Translates the TCP transport error codes to esp_err_t error codes
*

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -116,16 +116,6 @@ void esp_transport_destroy_foundation_transport(esp_foundation_transport_t *foun
*/
void capture_tcp_transport_error(esp_transport_handle_t t, enum esp_tcp_transport_err_t error);
/**
* @brief Returns underlying socket for the supplied transport handle
*
* @param t Transport handle
*
* @return Socket file descriptor in case of success
* -1 in case of error
*/
int esp_transport_get_socket(esp_transport_handle_t t);
/**
* @brief Captures the current errno
*

View File

@ -19,9 +19,6 @@
#define CONNECT_TASK_PRIORITY (LISTENER_TASK_PRIORITY+1)
#define CONNECT_TASK_PRIORITY_LOWER (LISTENER_TASK_PRIORITY-2)
// This is a private API of the tcp transport, but needed for socket operation tests
int esp_transport_get_socket(esp_transport_handle_t t);
/**
* @brief Event flags for synchronization between the listener task, the connection task and the test task
*/