feat(mosq): Added support for TLS transport using ESP-TLS

This commit is contained in:
David Cermak
2024-10-07 18:22:21 +02:00
parent 8c4f392f93
commit 1af4bbe1ab
15 changed files with 647 additions and 21 deletions
@@ -5,6 +5,7 @@
*/
#pragma once
#include "mosquitto.h"
#include "esp_tls.h"
struct mosquitto__config;
@@ -17,6 +18,12 @@ struct mosquitto__config;
struct mosq_broker_config {
char *host; /*!< Address on which the broker is listening for connections */
int port; /*!< Port number of the broker to listen to */
esp_tls_cfg_server_t *tls_cfg; /*!< ESP-TLS configuration (if TLS transport used)
* Please refer to the ESP-TLS official documentation
* for more details on configuring the TLS options.
* You can open the respective docs with this idf.py command:
* `idf.py docs -sp api-reference/protocols/esp_tls.html`
*/
};
/**
@@ -28,4 +35,11 @@ struct mosq_broker_config {
* @param config Mosquitto configuration structure
* @return int Exit code (0 on success)
*/
int mosq_broker_start(struct mosq_broker_config *config);
int mosq_broker_run(struct mosq_broker_config *config);
/**
* @brief Stops running broker
*
* @note After calling this API, function mosq_broker_run() unblocks and returns.
*/
void mosq_broker_stop(void);