esp_tls: Make esp_tls_t as private structure.

This commit is contained in:
Aditya Patwardhan
2022-04-20 08:09:13 +05:30
committed by BOT
parent 523c51818c
commit 434e74ff73
9 changed files with 180 additions and 76 deletions

View File

@@ -14,6 +14,7 @@
#include <http_parser.h>
#include "esp_tls.h"
#include "esp_tls_private.h"
#include "esp_tls_error_capture_internal.h"
#include <errno.h>
static const char *TAG = "esp-tls";
@@ -89,6 +90,18 @@ static ssize_t tcp_write(esp_tls_t *tls, const char *data, size_t datalen)
return send(tls->sockfd, data, datalen, 0);
}
ssize_t esp_tls_conn_read(esp_tls_t *tls, void *data, size_t datalen)
{
return tls->read(tls, (char *)data, datalen);
}
ssize_t esp_tls_conn_write(esp_tls_t *tls, const void *data, size_t datalen)
{
return tls->write(tls, (char *)data, datalen);
}
/**
* @brief Close the TLS connection and free any allocated resources.
*/
@@ -629,6 +642,16 @@ esp_err_t esp_tls_get_and_clear_last_error(esp_tls_error_handle_t h, int *esp_tl
return last_err;
}
esp_err_t esp_tls_get_error_handle(esp_tls_t *tls, esp_tls_error_handle_t *error_handle)
{
if (tls == NULL) {
return ESP_ERR_INVALID_ARG;
}
*error_handle = tls->error_handle;
return ESP_OK;
}
esp_err_t esp_tls_init_global_ca_store(void)
{
return _esp_tls_init_global_ca_store();