mqtt_client.h
Go to the documentation of this file.
1 /**
2  * @file mqtt_client.h
3  * @brief MQTT client
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _MQTT_CLIENT_H
32 #define _MQTT_CLIENT_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "mqtt/mqtt_common.h"
37 
38 //MQTT client support
39 #ifndef MQTT_CLIENT_SUPPORT
40  #define MQTT_CLIENT_SUPPORT ENABLED
41 #elif (MQTT_CLIENT_SUPPORT != ENABLED && MQTT_CLIENT_SUPPORT != DISABLED)
42  #error MQTT_CLIENT_SUPPORT parameter is not valid
43 #endif
44 
45 //MQTT over TLS
46 #ifndef MQTT_CLIENT_TLS_SUPPORT
47  #define MQTT_CLIENT_TLS_SUPPORT DISABLED
48 #elif (MQTT_CLIENT_TLS_SUPPORT != ENABLED && MQTT_CLIENT_TLS_SUPPORT != DISABLED)
49  #error MQTT_CLIENT_TLS_SUPPORT parameter is not valid
50 #endif
51 
52 //MQTT over WebSocket
53 #ifndef MQTT_CLIENT_WS_SUPPORT
54  #define MQTT_CLIENT_WS_SUPPORT DISABLED
55 #elif (MQTT_CLIENT_WS_SUPPORT != ENABLED && MQTT_CLIENT_WS_SUPPORT != DISABLED)
56  #error MQTT_CLIENT_WS_SUPPORT parameter is not valid
57 #endif
58 
59 //Default keep-alive time interval, in seconds
60 #ifndef MQTT_CLIENT_DEFAULT_KEEP_ALIVE
61  #define MQTT_CLIENT_DEFAULT_KEEP_ALIVE 0
62 #elif (MQTT_CLIENT_DEFAULT_KEEP_ALIVE < 0)
63  #error MQTT_CLIENT_DEFAULT_KEEP_ALIVE parameter is not valid
64 #endif
65 
66 //Default communication timeout, in milliseconds
67 #ifndef MQTT_CLIENT_DEFAULT_TIMEOUT
68  #define MQTT_CLIENT_DEFAULT_TIMEOUT 20000
69 #elif (MQTT_CLIENT_DEFAULT_TIMEOUT < 0)
70  #error MQTT_CLIENT_DEFAULT_TIMEOUT parameter is not valid
71 #endif
72 
73 //Maximum length of the hostname
74 #ifndef MQTT_CLIENT_MAX_HOST_LEN
75  #define MQTT_CLIENT_MAX_HOST_LEN 32
76 #elif (MQTT_CLIENT_MAX_HOST_LEN < 1)
77  #error MQTT_CLIENT_MAX_HOST_LEN parameter is not valid
78 #endif
79 
80 //Maximum length of the resource name
81 #ifndef MQTT_CLIENT_MAX_URI_LEN
82  #define MQTT_CLIENT_MAX_URI_LEN 16
83 #elif (MQTT_CLIENT_MAX_URI_LEN < 1)
84  #error MQTT_CLIENT_MAX_URI_LEN parameter is not valid
85 #endif
86 
87 //Maximum length of the client identifier
88 #ifndef MQTT_CLIENT_MAX_ID_LEN
89  #define MQTT_CLIENT_MAX_ID_LEN 23
90 #elif (MQTT_CLIENT_MAX_ID_LEN < 0)
91  #error MQTT_CLIENT_MAX_ID_LEN parameter is not valid
92 #endif
93 
94 //Maximum length of the user name
95 #ifndef MQTT_CLIENT_MAX_USERNAME_LEN
96  #define MQTT_CLIENT_MAX_USERNAME_LEN 16
97 #elif (MQTT_CLIENT_MAX_USERNAME_LEN < 0)
98  #error MQTT_CLIENT_MAX_USERNAME_LEN parameter is not valid
99 #endif
100 
101 //Maximum length of the password
102 #ifndef MQTT_CLIENT_MAX_PASSWORD_LEN
103  #define MQTT_CLIENT_MAX_PASSWORD_LEN 16
104 #elif (MQTT_CLIENT_MAX_PASSWORD_LEN < 0)
105  #error MQTT_CLIENT_MAX_PASSWORD_LEN parameter is not valid
106 #endif
107 
108 //Maximum length of the will topic
109 #ifndef MQTT_CLIENT_MAX_WILL_TOPIC_LEN
110  #define MQTT_CLIENT_MAX_WILL_TOPIC_LEN 16
111 #elif (MQTT_CLIENT_MAX_WILL_TOPIC_LEN < 0)
112  #error MQTT_CLIENT_MAX_WILL_TOPIC_LEN parameter is not valid
113 #endif
114 
115 //Maximum length of the will message payload
116 #ifndef MQTT_CLIENT_MAX_WILL_PAYLOAD_LEN
117  #define MQTT_CLIENT_MAX_WILL_PAYLOAD_LEN 16
118 #elif (MQTT_CLIENT_MAX_WILL_PAYLOAD_LEN < 0)
119  #error MQTT_CLIENT_MAX_WILL_PAYLOAD_LEN parameter is not valid
120 #endif
121 
122 //Size of the MQTT client buffer
123 #ifndef MQTT_CLIENT_BUFFER_SIZE
124  #define MQTT_CLIENT_BUFFER_SIZE 1024
125 #elif (MQTT_CLIENT_BUFFER_SIZE < 1)
126  #error MQTT_CLIENT_BUFFER_SIZE parameter is not valid
127 #endif
128 
129 //Application specific context
130 #ifndef MQTT_CLIENT_PRIVATE_CONTEXT
131  #define MQTT_CLIENT_PRIVATE_CONTEXT
132 #endif
133 
134 //TLS supported?
135 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
136  #include "core/crypto.h"
137  #include "tls.h"
138 #endif
139 
140 //WebSocket supported?
141 #if (MQTT_CLIENT_WS_SUPPORT == ENABLED)
142  #include "web_socket/web_socket.h"
143 #endif
144 
145 //Forward declaration of MqttClientContext structure
146 struct _MqttClientContext;
147 #define MqttClientContext struct _MqttClientContext
148 
149 //C++ guard
150 #ifdef __cplusplus
151 extern "C" {
152 #endif
153 
154 
155 /**
156  * @brief MQTT client states
157  **/
158 
159 typedef enum
160 {
172 
173 
174 /**
175  * @brief CONNACK message received callback
176  **/
177 
179  uint8_t connectAckFlags, uint8_t connectReturnCode);
180 
181 
182 /**
183  * @brief PUBLISH message received callback
184  **/
185 
187  const char_t *topic, const uint8_t *message, size_t length,
188  bool_t dup, MqttQosLevel qos, bool_t retain, uint16_t packetId);
189 
190 
191 /**
192  * @brief PUBACK message received callback
193  **/
194 
196  uint16_t packetId);
197 
198 
199 /**
200  * @brief PUBREC message received callback
201  **/
202 
204  uint16_t packetId);
205 
206 
207 /**
208  * @brief PUBREL message received callback
209  **/
210 
212  uint16_t packetId);
213 
214 
215 /**
216  * @brief PUBCOMP message received callback
217  **/
218 
220  uint16_t packetId);
221 
222 
223 /**
224  * @brief SUBACK message received callback
225  **/
226 
228  uint16_t packetId);
229 
230 
231 /**
232  * @brief UNSUBACK message received callback
233  **/
234 
236  uint16_t packetId);
237 
238 
239 /**
240  * @brief PINGRESP message received callback
241  **/
242 
244 
245 
246 //TLS supported?
247 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
248 
249 /**
250  * @brief TLS initialization callback
251  **/
252 
255 
256 #endif
257 
258 
259 /**
260  * @brief Will message
261  **/
262 
263 typedef struct
264 {
265  char_t topic[MQTT_CLIENT_MAX_WILL_TOPIC_LEN + 1]; ///<Will topic name
266  uint8_t payload[MQTT_CLIENT_MAX_WILL_PAYLOAD_LEN]; ///<Will message payload
267  size_t length; ///<Length of the Will message payload
268  MqttQosLevel qos; ///<QoS level to be used when publishing the Will message
269  bool_t retain; ///<Specifies if the Will message is to be retained
271 
272 
273 /**
274  * @brief MQTT client callback functions
275  **/
276 
277 typedef struct
278 {
279  MqttClientConnAckCallback connAckCallback; ///<CONNACK message received callback
280  MqttClientPublishCallback publishCallback; ///<PUBLISH message received callback
281  MqttClientPubAckCallback pubAckCallback; ///<PUBACK message received callback
282  MqttClientPubAckCallback pubRecCallback; ///<PUBREC message received callback
283  MqttClientPubAckCallback pubRelCallback; ///<PUBREL message received callback
284  MqttClientPubAckCallback pubCompCallback; ///<PUBCOMP message received callback
285  MqttClientPubAckCallback subAckCallback; ///<SUBACK message received callback
286  MqttClientPubAckCallback unsubAckCallback; ///<UNSUBACK message received callback
287  MqttClientPingRespCallback pingRespCallback; ///<PINGRESP message received callback
288 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
289  MqttClientTlsInitCallback tlsInitCallback; ///<TLS initialization callback
290 #endif
292 
293 
294 /**
295  * @brief MQTT client settings
296  **/
297 
298 typedef struct
299 {
300  MqttVersion version; ///<MQTT protocol version
301  MqttTransportProtocol transportProtocol; ///<Transport protocol
302  uint16_t keepAlive; ///<Keep-alive time interval
303  systime_t timeout; ///<Communication timeout
304 #if (MQTT_CLIENT_WS_SUPPORT == ENABLED)
305  char_t host[MQTT_CLIENT_MAX_HOST_LEN + 1]; ///<Domain name of the server (for virtual hosting)
306  char_t uri[MQTT_CLIENT_MAX_URI_LEN + 1]; ///<Resource name
307 #endif
308  char_t clientId[MQTT_CLIENT_MAX_ID_LEN + 1]; ///<Client identifier
309  char_t username[MQTT_CLIENT_MAX_USERNAME_LEN + 1]; ///<User name
310  char_t password[MQTT_CLIENT_MAX_PASSWORD_LEN + 1]; ///<Password
313 
314 
315 /**
316  * @brief MQTT client context
317  **/
318 
320 {
321  MqttClientSettings settings; ///<MQTT client settings
322  MqttClientCallbacks callbacks; ///<MQTT client callback functions
323  MqttClientState state; ///<MQTT client state
324  NetInterface *interface; ///<Underlying network interface
325  Socket *socket; ///<Underlying TCP socket
326 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
327  TlsContext *tlsContext; ///<TLS context
328  TlsSessionState tlsSession; ///<TLS session state
329 #endif
330 #if (MQTT_CLIENT_WS_SUPPORT == ENABLED)
331  WebSocket *webSocket; ///<Underlying WebSocket
332 #endif
333  systime_t startTime; ///<Start time
334  systime_t keepAliveTimestamp; ///<Timestamp used to manage keep-alive
335  uint8_t buffer[MQTT_CLIENT_BUFFER_SIZE]; ///<Internal buffer
336  uint8_t *packet; ///<Pointer to the incoming/outgoing MQTT packet
337  size_t packetPos; ///<Current position
338  size_t packetLen; ///<Length of the entire MQTT packet
339  MqttPacketType packetType; ///<Control packet type
340  uint16_t packetId; ///<Packet identifier
341  size_t remainingLen; ///<Length of the variable header and payload
342  MQTT_CLIENT_PRIVATE_CONTEXT ///<Application specific context
343 };
344 
345 
346 //MQTT client related functions
349 
351  const MqttClientCallbacks *callbacks);
352 
354 
356  MqttTransportProtocol transportProtocol);
357 
358 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
359 
361  MqttClientTlsInitCallback callback);
362 
363 #endif
364 
366  MqttClientPublishCallback callback);
367 
369 error_t mqttClientSetKeepAlive(MqttClientContext *context, uint16_t keepAlive);
370 
371 error_t mqttClientSetHost(MqttClientContext *context, const char_t *host);
372 error_t mqttClientSetUri(MqttClientContext *context, const char_t *uri);
373 
375  const char_t *clientId);
376 
378  const char_t *username, const char_t *password);
379 
381  const void *message, size_t length, MqttQosLevel qos, bool_t retain);
382 
384  NetInterface *interface);
385 
387  const IpAddr *serverIpAddr, uint16_t serverPort, bool_t cleanSession);
388 
390  const char_t *topic, const void *message, size_t length,
391  MqttQosLevel qos, bool_t retain, uint16_t *packetId);
392 
394  const char_t *topic, MqttQosLevel qos, uint16_t *packetId);
395 
397  const char_t *topic, uint16_t *packetId);
398 
400 
402 
405 
406 void mqttClientDeinit(MqttClientContext *context);
407 
408 //Deprecated functions
410 
411 //C++ guard
412 #ifdef __cplusplus
413 }
414 #endif
415 
416 #endif
uint8_t message[]
Definition: chap.h:154
uint8_t version
Definition: coap_common.h:177
char char_t
Definition: compiler_port.h:48
int bool_t
Definition: compiler_port.h:53
General definitions for cryptographic algorithms.
error_t
Error codes.
Definition: error.h:43
uint8_t payload[]
Definition: ipv6.h:277
error_t mqttClientSetVersion(MqttClientContext *context, MqttVersion version)
Set the MQTT protocol version to be used.
Definition: mqtt_client.c:138
#define MQTT_CLIENT_MAX_HOST_LEN
Definition: mqtt_client.h:75
error_t mqttClientInit(MqttClientContext *context)
Initialize MQTT client context.
Definition: mqtt_client.c:52
error_t mqttClientSetHost(MqttClientContext *context, const char_t *host)
Set the domain name of the server (for virtual hosting)
Definition: mqtt_client.c:275
void(* MqttClientSubAckCallback)(MqttClientContext *context, uint16_t packetId)
SUBACK message received callback.
Definition: mqtt_client.h:227
error_t mqttClientPublish(MqttClientContext *context, const char_t *topic, const void *message, size_t length, MqttQosLevel qos, bool_t retain, uint16_t *packetId)
Publish message.
Definition: mqtt_client.c:609
void mqttClientDeinit(MqttClientContext *context)
Release MQTT client context.
Definition: mqtt_client.c:1229
#define MQTT_CLIENT_BUFFER_SIZE
Definition: mqtt_client.h:124
void(* MqttClientConnAckCallback)(MqttClientContext *context, uint8_t connectAckFlags, uint8_t connectReturnCode)
CONNACK message received callback.
Definition: mqtt_client.h:178
error_t mqttClientDisconnect(MqttClientContext *context)
Gracefully disconnect from the MQTT server.
Definition: mqtt_client.c:1105
error_t mqttClientSetTransportProtocol(MqttClientContext *context, MqttTransportProtocol transportProtocol)
Set the transport protocol to be used.
Definition: mqtt_client.c:160
void(* MqttClientPublishCallback)(MqttClientContext *context, const char_t *topic, const uint8_t *message, size_t length, bool_t dup, MqttQosLevel qos, bool_t retain, uint16_t packetId)
PUBLISH message received callback.
Definition: mqtt_client.h:186
MqttClientState
MQTT client states.
Definition: mqtt_client.h:160
@ MQTT_CLIENT_STATE_PACKET_RECEIVED
Definition: mqtt_client.h:169
@ MQTT_CLIENT_STATE_RECEIVING_PACKET
Definition: mqtt_client.h:168
@ MQTT_CLIENT_STATE_DISCONNECTING
Definition: mqtt_client.h:170
@ MQTT_CLIENT_STATE_IDLE
Definition: mqtt_client.h:164
@ MQTT_CLIENT_STATE_PACKET_SENT
Definition: mqtt_client.h:166
@ MQTT_CLIENT_STATE_CONNECTING
Definition: mqtt_client.h:162
@ MQTT_CLIENT_STATE_CONNECTED
Definition: mqtt_client.h:163
@ MQTT_CLIENT_STATE_WAITING_PACKET
Definition: mqtt_client.h:167
@ MQTT_CLIENT_STATE_SENDING_PACKET
Definition: mqtt_client.h:165
@ MQTT_CLIENT_STATE_DISCONNECTED
Definition: mqtt_client.h:161
error_t mqttClientSubscribe(MqttClientContext *context, const char_t *topic, MqttQosLevel qos, uint16_t *packetId)
Subscribe to topic.
Definition: mqtt_client.c:737
error_t mqttClientSetKeepAlive(MqttClientContext *context, uint16_t keepAlive)
Set keep-alive value.
Definition: mqtt_client.c:254
error_t mqttClientUnsubscribe(MqttClientContext *context, const char_t *topic, uint16_t *packetId)
Unsubscribe from topic.
Definition: mqtt_client.c:850
void(* MqttClientPubRecCallback)(MqttClientContext *context, uint16_t packetId)
PUBREC message received callback.
Definition: mqtt_client.h:203
void(* MqttClientPingRespCallback)(MqttClientContext *context)
PINGRESP message received callback.
Definition: mqtt_client.h:243
error_t mqttClientConnect(MqttClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort, bool_t cleanSession)
Establish connection with the MQTT server.
Definition: mqtt_client.c:471
#define MQTT_CLIENT_MAX_USERNAME_LEN
Definition: mqtt_client.h:96
error_t mqttClientClose(MqttClientContext *context)
Close the connection with the MQTT server.
Definition: mqtt_client.c:1208
void(* MqttClientPubAckCallback)(MqttClientContext *context, uint16_t packetId)
PUBACK message received callback.
Definition: mqtt_client.h:195
error_t mqttClientSetIdentifier(MqttClientContext *context, const char_t *clientId)
Set client identifier.
Definition: mqtt_client.c:329
error_t mqttClientRegisterTlsInitCallback(MqttClientContext *context, MqttClientTlsInitCallback callback)
Register TLS initialization callback function.
Definition: mqtt_client.c:184
error_t mqttClientPing(MqttClientContext *context, systime_t *rtt)
Send ping request.
Definition: mqtt_client.c:962
#define MQTT_CLIENT_MAX_WILL_PAYLOAD_LEN
Definition: mqtt_client.h:117
void(* MqttClientUnsubAckCallback)(MqttClientContext *context, uint16_t packetId)
UNSUBACK message received callback.
Definition: mqtt_client.h:235
error_t mqttClientSetUri(MqttClientContext *context, const char_t *uri)
Set the name of the resource being requested.
Definition: mqtt_client.c:302
void mqttClientInitCallbacks(MqttClientCallbacks *callbacks)
Initialize callback structure.
Definition: mqtt_client.c:102
error_t mqttClientBindToInterface(MqttClientContext *context, NetInterface *interface)
Bind the MQTT client to a particular network interface.
Definition: mqtt_client.c:445
#define MQTT_CLIENT_PRIVATE_CONTEXT
Definition: mqtt_client.h:131
void(* MqttClientPubCompCallback)(MqttClientContext *context, uint16_t packetId)
PUBCOMP message received callback.
Definition: mqtt_client.h:219
error_t(* MqttClientTlsInitCallback)(MqttClientContext *context, TlsContext *tlsContext)
TLS initialization callback.
Definition: mqtt_client.h:253
error_t mqttClientRegisterPublishCallback(MqttClientContext *context, MqttClientPublishCallback callback)
Register publish callback function.
Definition: mqtt_client.c:209
#define MQTT_CLIENT_MAX_WILL_TOPIC_LEN
Definition: mqtt_client.h:110
#define MqttClientContext
Definition: mqtt_client.h:147
#define MQTT_CLIENT_MAX_PASSWORD_LEN
Definition: mqtt_client.h:103
void(* MqttClientPubRelCallback)(MqttClientContext *context, uint16_t packetId)
PUBREL message received callback.
Definition: mqtt_client.h:211
error_t mqttClientSetTimeout(MqttClientContext *context, systime_t timeout)
Set communication timeout.
Definition: mqtt_client.c:231
error_t mqttClientSetWillMessage(MqttClientContext *context, const char_t *topic, const void *message, size_t length, MqttQosLevel qos, bool_t retain)
Specify the Will message.
Definition: mqtt_client.c:392
#define MQTT_CLIENT_MAX_ID_LEN
Definition: mqtt_client.h:89
error_t mqttClientSetAuthInfo(MqttClientContext *context, const char_t *username, const char_t *password)
Set authentication information.
Definition: mqtt_client.c:356
error_t mqttClientTask(MqttClientContext *context, systime_t timeout)
Process MQTT client events.
Definition: mqtt_client.c:1076
error_t mqttClientRegisterCallbacks(MqttClientContext *context, const MqttClientCallbacks *callbacks)
Register MQTT client callbacks.
Definition: mqtt_client.c:116
error_t mqttClientProcessEvents(MqttClientContext *context, systime_t timeout)
Process MQTT client events.
#define MQTT_CLIENT_MAX_URI_LEN
Definition: mqtt_client.h:82
Definitions common to MQTT client and server.
uint8_t dup
Definition: mqtt_common.h:182
uint8_t qos
Definition: mqtt_common.h:181
MqttQosLevel
Quality of service level.
Definition: mqtt_common.h:87
MqttTransportProtocol
Transport protocol.
Definition: mqtt_common.h:74
MqttVersion
MQTT protocol level.
Definition: mqtt_common.h:63
MqttPacketType
MQTT control packet type.
Definition: mqtt_common.h:99
char_t clientId[]
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
uint32_t systime_t
System time.
#define Socket
Definition: socket.h:36
MQTT client context.
Definition: mqtt_client.h:320
uint8_t * packet
Pointer to the incoming/outgoing MQTT packet.
Definition: mqtt_client.h:336
size_t packetPos
Current position.
Definition: mqtt_client.h:337
MqttClientState state
MQTT client state.
Definition: mqtt_client.h:323
WebSocket * webSocket
Underlying WebSocket.
Definition: mqtt_client.h:331
uint8_t buffer[MQTT_CLIENT_BUFFER_SIZE]
Internal buffer.
Definition: mqtt_client.h:335
TlsContext * tlsContext
TLS context.
Definition: mqtt_client.h:327
MqttClientCallbacks callbacks
MQTT client callback functions.
Definition: mqtt_client.h:322
uint16_t packetId
Packet identifier.
Definition: mqtt_client.h:340
systime_t keepAliveTimestamp
Timestamp used to manage keep-alive.
Definition: mqtt_client.h:334
Socket * socket
Underlying TCP socket.
Definition: mqtt_client.h:325
size_t remainingLen
Length of the variable header and payload.
Definition: mqtt_client.h:341
systime_t startTime
Start time.
Definition: mqtt_client.h:333
TlsSessionState tlsSession
TLS session state.
Definition: mqtt_client.h:328
MqttClientSettings settings
MQTT client settings.
Definition: mqtt_client.h:321
size_t packetLen
Length of the entire MQTT packet.
Definition: mqtt_client.h:338
NetInterface * interface
Underlying network interface.
Definition: mqtt_client.h:324
MqttPacketType packetType
Control packet type.
Definition: mqtt_client.h:339
IP network address.
Definition: ip.h:79
MQTT client callback functions.
Definition: mqtt_client.h:278
MqttClientPingRespCallback pingRespCallback
PINGRESP message received callback.
Definition: mqtt_client.h:287
MqttClientPubAckCallback pubRecCallback
PUBREC message received callback.
Definition: mqtt_client.h:282
MqttClientPubAckCallback unsubAckCallback
UNSUBACK message received callback.
Definition: mqtt_client.h:286
MqttClientPubAckCallback pubRelCallback
PUBREL message received callback.
Definition: mqtt_client.h:283
MqttClientPublishCallback publishCallback
PUBLISH message received callback.
Definition: mqtt_client.h:280
MqttClientPubAckCallback subAckCallback
SUBACK message received callback.
Definition: mqtt_client.h:285
MqttClientTlsInitCallback tlsInitCallback
TLS initialization callback.
Definition: mqtt_client.h:289
MqttClientPubAckCallback pubCompCallback
PUBCOMP message received callback.
Definition: mqtt_client.h:284
MqttClientPubAckCallback pubAckCallback
PUBACK message received callback.
Definition: mqtt_client.h:281
MqttClientConnAckCallback connAckCallback
CONNACK message received callback.
Definition: mqtt_client.h:279
MQTT client settings.
Definition: mqtt_client.h:299
MqttTransportProtocol transportProtocol
Transport protocol.
Definition: mqtt_client.h:301
MqttClientWillMessage willMessage
Will message.
Definition: mqtt_client.h:311
uint16_t keepAlive
Keep-alive time interval.
Definition: mqtt_client.h:302
MqttVersion version
MQTT protocol version.
Definition: mqtt_client.h:300
systime_t timeout
Communication timeout.
Definition: mqtt_client.h:303
size_t length
Length of the Will message payload.
Definition: mqtt_client.h:267
MqttQosLevel qos
QoS level to be used when publishing the Will message.
Definition: mqtt_client.h:268
bool_t retain
Specifies if the Will message is to be retained.
Definition: mqtt_client.h:269
TLS session state.
Definition: tls.h:2021
uint8_t length
Definition: tcp.h:368
TLS (Transport Layer Security)
#define TlsContext
Definition: tls.h:36
WebSocket API (client and server)
#define WebSocket
Definition: web_socket.h:177