Skip to content

Commit fa88da5

Browse files
Merge branch 'lifetime_clarification' into 'master'
Clarify data that users need to take care of lifetime. See merge request espressif/esp-mqtt!197
2 parents 5a35782 + 371f594 commit fa88da5

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

include/mqtt_client.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ typedef struct esp_mqtt_event_t {
214214

215215
typedef esp_mqtt_event_t *esp_mqtt_event_handle_t;
216216

217-
218217
/**
219218
* *MQTT* client configuration structure
220219
*
@@ -250,20 +249,21 @@ typedef struct esp_mqtt_client_config_t {
250249
bool use_global_ca_store; /*!< Use a global ca_store, look esp-tls
251250
documentation for details. */
252251
esp_err_t (*crt_bundle_attach)(void *conf); /*!< Pointer to ESP x509 Certificate Bundle attach function for
253-
the usage of certificate bundles. */
254-
const char *certificate; /*!< Certificate data, default is NULL, not required to verify the server. */
252+
the usage of certificate bundles. Client only attach the bundle, the clean up must be done by the user. */
253+
const char *certificate; /*!< Certificate data, default is NULL. It's not copied nor freed by the client, user needs to clean up.*/
255254
size_t certificate_len; /*!< Length of the buffer pointed to by certificate. */
256255
const struct psk_key_hint *psk_hint_key; /*!< Pointer to PSK struct defined in esp_tls.h to enable PSK
257256
authentication (as alternative to certificate verification).
258257
PSK is enabled only if there are no other ways to
259-
verify broker.*/
258+
verify broker. It's not copied nor freed by the client, user needs to clean up.*/
260259
bool skip_cert_common_name_check; /*!< Skip any validation of server certificate CN field, this reduces the
261260
security of TLS and makes the *MQTT* client susceptible to MITM attacks */
262-
const char **alpn_protos; /*!< NULL-terminated list of supported application protocols to be used for ALPN */
263-
const char *common_name; /*!< Pointer to the string containing server certificate common name.
261+
const char **alpn_protos; /*!< NULL-terminated list of supported application protocols to be used for ALPN.*/
262+
const char *common_name; /*!< Pointer to the string containing server certificate common name.
264263
If non-NULL, server certificate CN must match this name,
265264
If NULL, server certificate CN must match hostname.
266-
This is ignored if skip_cert_common_name_check=true. */
265+
This is ignored if skip_cert_common_name_check=true.
266+
It's not copied nor freed by the client, user needs to clean up.*/
267267
} verification; /*!< Security verification of the broker */
268268
} broker; /*!< Broker address and security verification */
269269
/**
@@ -287,17 +287,17 @@ typedef struct esp_mqtt_client_config_t {
287287
struct authentication_t {
288288
const char *password; /*!< *MQTT* password */
289289
const char *certificate; /*!< Certificate for ssl mutual authentication, not required if mutual
290-
authentication is not needed. Must be provided with `key`.*/
290+
authentication is not needed. Must be provided with `key`. It's not copied nor freed by the client, user needs to clean up.*/
291291
size_t certificate_len; /*!< Length of the buffer pointed to by certificate.*/
292292
const char *key; /*!< Private key for SSL mutual authentication, not required if mutual authentication
293-
is not needed. If it is not NULL, also `certificate` has to be provided.*/
293+
is not needed. If it is not NULL, also `certificate` has to be provided. It's not copied nor freed by the client, user needs to clean up.*/
294294
size_t key_len; /*!< Length of the buffer pointed to by key.*/
295295
const char *key_password; /*!< Client key decryption password, not PEM nor DER, if provided
296-
`key_password_len` must be correctly set. */
296+
`key_password_len` must be correctly set.*/
297297
int key_password_len; /*!< Length of the password pointed to by `key_password` */
298298
bool use_secure_element; /*!< Enable secure element, available in ESP32-ROOM-32SE, for SSL connection */
299299
void *ds_data; /*!< Carrier of handle for digital signature parameters, digital signature peripheral is
300-
available in some Espressif devices. */
300+
available in some Espressif devices. It's not copied nor freed by the client, user needs to clean up.*/
301301
} authentication; /*!< Client authentication */
302302
} credentials; /*!< User credentials for broker */
303303
/**
@@ -625,9 +625,9 @@ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client,
625625
* ESP_OK on success
626626
*/
627627
esp_err_t esp_mqtt_client_register_event(esp_mqtt_client_handle_t client,
628-
esp_mqtt_event_id_t event,
629-
esp_event_handler_t event_handler,
630-
void *event_handler_arg);
628+
esp_mqtt_event_id_t event,
629+
esp_event_handler_t event_handler,
630+
void *event_handler_arg);
631631

632632
/**
633633
* @brief Unregisters mqtt event

0 commit comments

Comments
 (0)