tcp_transport: Fix error propogation

- Made tcp_transport_errors codes public to indicate
  TCP connection issues not covered in socket's errno
- Added API to translate tcp_transport_error codes
  to esp_err_t codes for TCP Transport

Co-authored-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
This commit is contained in:
Laukik Hase
2022-03-07 10:59:54 +05:30
parent 01d014c42d
commit cc7c67ad4e
5 changed files with 105 additions and 36 deletions

View File

@@ -53,6 +53,9 @@
#if __has_include("esp_tls_errors.h")
#include "esp_tls_errors.h"
#endif
#if __has_include("esp_transport.h")
#include "esp_transport.h"
#endif
#if __has_include("esp_wifi.h")
#include "esp_wifi.h"
#endif
@@ -796,6 +799,23 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# endif
# ifdef ESP_ERR_MEMPROT_AREA_INVALID
ERR_TBL_IT(ESP_ERR_MEMPROT_AREA_INVALID), /* 53255 0xd007 */
# endif
// components/tcp_transport/include/esp_transport.h
# ifdef ESP_ERR_TCP_TRANSPORT_BASE
ERR_TBL_IT(ESP_ERR_TCP_TRANSPORT_BASE), /* 57344 0xe000 Starting number of TCP Transport error codes */
# endif
# ifdef ESP_ERR_TCP_TRANSPORT_CONNECTION_TIMEOUT
ERR_TBL_IT(ESP_ERR_TCP_TRANSPORT_CONNECTION_TIMEOUT), /* 57345 0xe001 Connection has timed out */
# endif
# ifdef ESP_ERR_TCP_TRANSPORT_CONNECTION_CLOSED_BY_FIN
ERR_TBL_IT(ESP_ERR_TCP_TRANSPORT_CONNECTION_CLOSED_BY_FIN), /* 57346 0xe002 Read FIN from peer and the connection
has closed (in a clean way) */
# endif
# ifdef ESP_ERR_TCP_TRANSPORT_CONNECTION_FAILED
ERR_TBL_IT(ESP_ERR_TCP_TRANSPORT_CONNECTION_FAILED), /* 57347 0xe003 Failed to connect to the peer */
# endif
# ifdef ESP_ERR_TCP_TRANSPORT_NO_MEM
ERR_TBL_IT(ESP_ERR_TCP_TRANSPORT_NO_MEM), /* 57348 0xe004 Memory allocation failed */
# endif
};
#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP