esp_tls: Renamed public API to indicate the Plain TCP connection

Also added parameter checks if used from as a public API
and updated the `is_plein_tcp` description that it's possible to connect
directly using plain tcp transport with the new API.
This commit is contained in:
David Cermak
2021-05-19 12:58:06 +02:00
parent 38fd2ed10b
commit f68d7d7023
3 changed files with 20 additions and 5 deletions

View File

@@ -171,7 +171,10 @@ typedef struct esp_tls_cfg {
void *ds_data; /*!< Pointer for digital signature peripheral context */
bool is_plain_tcp; /*!< Use non-TLS connection: When set to true, the esp-tls uses
plain TCP transport rather then TLS/SSL connection */
plain TCP transport rather then TLS/SSL connection.
Note, that it is possible to connect using a plain tcp transport
directly with esp_tls_plain_tcp_connect() API */
struct ifreq *if_name; /*!< The name of interface for data to go through. Use the default interface without setting */
} esp_tls_cfg_t;
@@ -609,9 +612,10 @@ void esp_tls_server_session_delete(esp_tls_t *tls);
* @param[out] error_handle ESP-TLS error handle holding potential errors occurred during connection
* @param[out] sockfd Socket descriptor if successfully connected on TCP layer
* @return ESP_OK on success
* ESP_ERR_INVALID_ARG if invalid output parameters
* ESP-TLS based error codes on failure
*/
esp_err_t esp_tls_tcp_connect(const char *host, int hostlen, int port, const esp_tls_cfg_t *cfg, esp_tls_error_handle_t error_handle, int *sockfd);
esp_err_t esp_tls_plain_tcp_connect(const char *host, int hostlen, int port, const esp_tls_cfg_t *cfg, esp_tls_error_handle_t error_handle, int *sockfd);
#ifdef __cplusplus
}