Skip to content

Commit c416976

Browse files
0xFEEDC0DE64david-cermak
authored andcommitted
fix(mosq): Make mosquitto component c++ compatible
Closes #817 Closes #816
1 parent f43dd50 commit c416976

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

components/mosquitto/port/include/mosq_broker.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
#pragma once
77
#include "mosquitto.h"
88
#include "esp_tls.h"
99

10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
1014
struct mosquitto__config;
1115

1216
typedef void (*mosq_message_cb_t)(char *client, char *topic, char *data, int len, int qos, int retain);
@@ -17,7 +21,7 @@ typedef void (*mosq_message_cb_t)(char *client, char *topic, char *data, int len
1721
* structure.
1822
*/
1923
struct mosq_broker_config {
20-
char *host; /*!< Address on which the broker is listening for connections */
24+
const char *host; /*!< Address on which the broker is listening for connections */
2125
int port; /*!< Port number of the broker to listen to */
2226
esp_tls_cfg_server_t *tls_cfg; /*!< ESP-TLS configuration (if TLS transport used)
2327
* Please refer to the ESP-TLS official documentation
@@ -48,3 +52,7 @@ int mosq_broker_run(struct mosq_broker_config *config);
4852
* @note After calling this API, function mosq_broker_run() unblocks and returns.
4953
*/
5054
void mosq_broker_stop(void);
55+
56+
#ifdef __cplusplus
57+
}
58+
#endif

0 commit comments

Comments
 (0)