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-2020 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 1.9.8
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 //TLS supported?
130 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
131  #include "core/crypto.h"
132  #include "tls.h"
133 #endif
134 
135 //WebSocket supported?
136 #if (MQTT_CLIENT_WS_SUPPORT == ENABLED)
137  #include "web_socket/web_socket.h"
138 #endif
139 
140 //Forward declaration of MqttClientContext structure
141 struct _MqttClientContext;
142 #define MqttClientContext struct _MqttClientContext
143 
144 //C++ guard
145 #ifdef __cplusplus
146 extern "C" {
147 #endif
148 
149 
150 /**
151  * @brief MQTT client states
152  **/
153 
154 typedef enum
155 {
167 
168 
169 /**
170  * @brief CONNACK message received callback
171  **/
172 
174  uint8_t connectAckFlags, uint8_t connectReturnCode);
175 
176 
177 /**
178  * @brief PUBLISH message received callback
179  **/
180 
182  const char_t *topic, const uint8_t *message, size_t length,
184 
185 
186 /**
187  * @brief PUBACK message received callback
188  **/
189 
191  uint16_t packetId);
192 
193 
194 /**
195  * @brief PUBREC message received callback
196  **/
197 
199  uint16_t packetId);
200 
201 
202 /**
203  * @brief PUBREL message received callback
204  **/
205 
207  uint16_t packetId);
208 
209 
210 /**
211  * @brief PUBCOMP message received callback
212  **/
213 
215  uint16_t packetId);
216 
217 
218 /**
219  * @brief SUBACK message received callback
220  **/
221 
223  uint16_t packetId);
224 
225 
226 /**
227  * @brief UNSUBACK message received callback
228  **/
229 
231  uint16_t packetId);
232 
233 
234 /**
235  * @brief PINGRESP message received callback
236  **/
237 
239 
240 
241 //TLS supported?
242 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
243 
244 /**
245  * @brief TLS initialization callback
246  **/
247 
250 
251 #endif
252 
253 
254 /**
255  * @brief Will message
256  **/
257 
258 typedef struct
259 {
260  char_t topic[MQTT_CLIENT_MAX_WILL_TOPIC_LEN + 1]; ///<Will topic name
261  uint8_t payload[MQTT_CLIENT_MAX_WILL_PAYLOAD_LEN]; ///<Will message payload
262  size_t length; ///<Length of the Will message payload
263  MqttQosLevel qos; ///<QoS level to be used when publishing the Will message
264  bool_t retain; ///<Specifies if the Will message is to be retained
266 
267 
268 /**
269  * @brief MQTT client callback functions
270  **/
271 
272 typedef struct
273 {
274  MqttClientConnAckCallback connAckCallback; ///<CONNACK message received callback
275  MqttClientPublishCallback publishCallback; ///<PUBLISH message received callback
276  MqttClientPubAckCallback pubAckCallback; ///<PUBACK message received callback
277  MqttClientPubAckCallback pubRecCallback; ///<PUBREC message received callback
278  MqttClientPubAckCallback pubRelCallback; ///<PUBREL message received callback
279  MqttClientPubAckCallback pubCompCallback; ///<PUBCOMP message received callback
280  MqttClientPubAckCallback subAckCallback; ///<SUBACK message received callback
281  MqttClientPubAckCallback unsubAckCallback; ///<UNSUBACK message received callback
282  MqttClientPingRespCallback pingRespCallback; ///<PINGRESP message received callback
283 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
284  MqttClientTlsInitCallback tlsInitCallback; ///<TLS initialization callback
285 #endif
287 
288 
289 /**
290  * @brief MQTT client settings
291  **/
292 
293 typedef struct
294 {
295  MqttVersion version; ///<MQTT protocol version
296  MqttTransportProtocol transportProtocol; ///<Transport protocol
297  uint16_t keepAlive; ///<Keep-alive time interval
298  systime_t timeout; ///<Communication timeout
299 #if (MQTT_CLIENT_WS_SUPPORT == ENABLED)
300  char_t host[MQTT_CLIENT_MAX_HOST_LEN + 1]; ///<Domain name of the server (for virtual hosting)
301  char_t uri[MQTT_CLIENT_MAX_URI_LEN + 1]; ///<Resource name
302 #endif
303  char_t clientId[MQTT_CLIENT_MAX_ID_LEN + 1]; ///<Client identifier
304  char_t username[MQTT_CLIENT_MAX_USERNAME_LEN + 1]; ///<User name
305  char_t password[MQTT_CLIENT_MAX_PASSWORD_LEN + 1]; ///<Password
308 
309 
310 /**
311  * @brief MQTT client context
312  **/
313 
315 {
316  MqttClientSettings settings; ///<MQTT client settings
317  MqttClientCallbacks callbacks; ///<MQTT client callback functions
318  MqttClientState state; ///<MQTT client state
319  NetInterface *interface; ///<Underlying network interface
320  Socket *socket; ///<Underlying TCP socket
321 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
322  TlsContext *tlsContext; ///<TLS context
323  TlsSessionState tlsSession; ///<TLS session state
324 #endif
325 #if (MQTT_CLIENT_WS_SUPPORT == ENABLED)
326  WebSocket *webSocket; ///<Underlying WebSocket
327 #endif
328  systime_t startTime; ///<Start time
329  systime_t keepAliveTimestamp; ///<Timestamp used to manage keep-alive
330  uint8_t buffer[MQTT_CLIENT_BUFFER_SIZE]; ///<Internal buffer
331  uint8_t *packet; ///<Pointer to the incoming/outgoing MQTT packet
332  size_t packetPos; ///<Current position
333  size_t packetLen; ///<Length of the entire MQTT packet
334  MqttPacketType packetType; ///<Control packet type
335  uint16_t packetId; ///<Packet identifier
336  size_t remainingLen; ///<Length of the variable header and payload
337 };
338 
339 
340 //MQTT client related functions
343 
345  const MqttClientCallbacks *callbacks);
346 
348 
350  MqttTransportProtocol transportProtocol);
351 
352 #if (MQTT_CLIENT_TLS_SUPPORT == ENABLED)
353 
355  MqttClientTlsInitCallback callback);
356 
357 #endif
358 
360  MqttClientPublishCallback callback);
361 
363 error_t mqttClientSetKeepAlive(MqttClientContext *context, uint16_t keepAlive);
364 
365 error_t mqttClientSetHost(MqttClientContext *context, const char_t *host);
366 error_t mqttClientSetUri(MqttClientContext *context, const char_t *uri);
367 
369  const char_t *clientId);
370 
372  const char_t *username, const char_t *password);
373 
375  const void *message, size_t length, MqttQosLevel qos, bool_t retain);
376 
378  NetInterface *interface);
379 
381  const IpAddr *serverIpAddr, uint16_t serverPort, bool_t cleanSession);
382 
384  const char_t *topic, const void *message, size_t length,
385  MqttQosLevel qos, bool_t retain, uint16_t *packetId);
386 
388  const char_t *topic, MqttQosLevel qos, uint16_t *packetId);
389 
391  const char_t *topic, uint16_t *packetId);
392 
394 
396 
399 
400 void mqttClientDeinit(MqttClientContext *context);
401 
402 //Deprecated functions
404 
405 //C++ guard
406 #ifdef __cplusplus
407 }
408 #endif
409 
410 #endif
MqttClientPublishCallback publishCallback
PUBLISH message received callback.
Definition: mqtt_client.h:275
void(* MqttClientPubAckCallback)(MqttClientContext *context, uint16_t packetId)
PUBACK message received callback.
Definition: mqtt_client.h:190
uint8_t length
Definition: coap_common.h:190
int bool_t
Definition: compiler_port.h:49
MQTT client context.
Definition: mqtt_client.h:314
MqttClientPubAckCallback pubAckCallback
PUBACK message received callback.
Definition: mqtt_client.h:276
error_t(* MqttClientTlsInitCallback)(MqttClientContext *context, TlsContext *tlsContext)
TLS initialization callback.
Definition: mqtt_client.h:248
error_t mqttClientTask(MqttClientContext *context, systime_t timeout)
Process MQTT client events.
Definition: mqtt_client.c:1077
MqttTransportProtocol transportProtocol
Transport protocol.
Definition: mqtt_client.h:296
WebSocket * webSocket
Underlying WebSocket.
Definition: mqtt_client.h:326
IP network address.
Definition: ip.h:78
MqttTransportProtocol
Transport protocol.
Definition: mqtt_common.h:73
uint16_t packetId
Packet identifier.
Definition: mqtt_client.h:335
void mqttClientDeinit(MqttClientContext *context)
Release MQTT client context.
Definition: mqtt_client.c:1230
MqttPacketType packetType
Control packet type.
Definition: mqtt_client.h:334
MqttVersion version
MQTT protocol version.
Definition: mqtt_client.h:295
WebSocket API (client and server)
error_t mqttClientInit(MqttClientContext *context)
Initialize MQTT client context.
Definition: mqtt_client.c:52
MqttClientState state
MQTT client state.
Definition: mqtt_client.h:318
MqttClientPubAckCallback subAckCallback
SUBACK message received callback.
Definition: mqtt_client.h:280
TlsContext * tlsContext
TLS context.
Definition: mqtt_client.h:322
void(* MqttClientPubRelCallback)(MqttClientContext *context, uint16_t packetId)
PUBREL message received callback.
Definition: mqtt_client.h:206
MqttClientPubAckCallback unsubAckCallback
UNSUBACK message received callback.
Definition: mqtt_client.h:281
error_t mqttClientSetIdentifier(MqttClientContext *context, const char_t *clientId)
Set client identifier.
Definition: mqtt_client.c:329
uint8_t qos
Definition: mqtt_common.h:179
uint8_t version
Definition: coap_common.h:172
MqttClientPubAckCallback pubRecCallback
PUBREC message received callback.
Definition: mqtt_client.h:277
void(* MqttClientPubRecCallback)(MqttClientContext *context, uint16_t packetId)
PUBREC message received callback.
Definition: mqtt_client.h:198
size_t packetLen
Length of the entire MQTT packet.
Definition: mqtt_client.h:333
error_t mqttClientSetTimeout(MqttClientContext *context, systime_t timeout)
Set communication timeout.
Definition: mqtt_client.c:231
MQTT client callback functions.
Definition: mqtt_client.h:272
error_t mqttClientUnsubscribe(MqttClientContext *context, const char_t *topic, uint16_t *packetId)
Unsubscribe from topic.
Definition: mqtt_client.c:851
void(* MqttClientConnAckCallback)(MqttClientContext *context, uint8_t connectAckFlags, uint8_t connectReturnCode)
CONNACK message received callback.
Definition: mqtt_client.h:173
MqttClientWillMessage willMessage
Will message.
Definition: mqtt_client.h:306
error_t mqttClientProcessEvents(MqttClientContext *context, systime_t timeout)
Process MQTT client events.
error_t mqttClientConnect(MqttClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort, bool_t cleanSession)
Establish connection with the MQTT server.
Definition: mqtt_client.c:472
#define MQTT_CLIENT_MAX_USERNAME_LEN
Definition: mqtt_client.h:96
MqttClientSettings settings
MQTT client settings.
Definition: mqtt_client.h:316
error_t mqttClientClose(MqttClientContext *context)
Close the connection with the MQTT server.
Definition: mqtt_client.c:1209
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:42
void(* MqttClientSubAckCallback)(MqttClientContext *context, uint16_t packetId)
SUBACK message received callback.
Definition: mqtt_client.h:222
error_t mqttClientRegisterTlsInitCallback(MqttClientContext *context, MqttClientTlsInitCallback callback)
Register TLS initialization callback function.
Definition: mqtt_client.c:184
uint16_t keepAlive
Keep-alive time interval.
Definition: mqtt_client.h:297
error_t mqttClientSetVersion(MqttClientContext *context, MqttVersion version)
Set the MQTT protocol version to be used.
Definition: mqtt_client.c:138
MqttQosLevel
Quality of service level.
Definition: mqtt_common.h:86
uint8_t retain
Definition: mqtt_common.h:178
#define MQTT_CLIENT_MAX_WILL_TOPIC_LEN
Definition: mqtt_client.h:110
MqttClientPingRespCallback pingRespCallback
PINGRESP message received callback.
Definition: mqtt_client.h:282
MqttClientConnAckCallback connAckCallback
CONNACK message received callback.
Definition: mqtt_client.h:274
uint8_t * packet
Pointer to the incoming/outgoing MQTT packet.
Definition: mqtt_client.h:331
#define NetInterface
Definition: net.h:36
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:610
MqttClientPubAckCallback pubRelCallback
PUBREL message received callback.
Definition: mqtt_client.h:278
General definitions for cryptographic algorithms.
MQTT client settings.
Definition: mqtt_client.h:293
error_t mqttClientSetTransportProtocol(MqttClientContext *context, MqttTransportProtocol transportProtocol)
Set the transport protocol to be used.
Definition: mqtt_client.c:160
systime_t keepAliveTimestamp
Timestamp used to manage keep-alive.
Definition: mqtt_client.h:329
error_t mqttClientPing(MqttClientContext *context, systime_t *rtt)
Send ping request.
Definition: mqtt_client.c:963
TlsSessionState tlsSession
TLS session state.
Definition: mqtt_client.h:323
systime_t startTime
Start time.
Definition: mqtt_client.h:328
#define MQTT_CLIENT_MAX_URI_LEN
Definition: mqtt_client.h:82
size_t remainingLen
Length of the variable header and payload.
Definition: mqtt_client.h:336
MqttVersion
MQTT protocol level.
Definition: mqtt_common.h:62
#define WebSocket
Definition: web_socket.h:177
bool_t retain
Specifies if the Will message is to be retained.
Definition: mqtt_client.h:264
error_t mqttClientSetUri(MqttClientContext *context, const char_t *uri)
Set the name of the resource being requested.
Definition: mqtt_client.c:302
Definitions common to MQTT client and server.
NetInterface * interface
Underlying network interface.
Definition: mqtt_client.h:319
size_t length
Length of the Will message payload.
Definition: mqtt_client.h:262
char char_t
Definition: compiler_port.h:43
MqttClientCallbacks callbacks
MQTT client callback functions.
Definition: mqtt_client.h:317
TLS session state.
Definition: tls.h:1865
MqttClientTlsInitCallback tlsInitCallback
TLS initialization callback.
Definition: mqtt_client.h:284
#define MQTT_CLIENT_MAX_ID_LEN
Definition: mqtt_client.h:89
void(* MqttClientPingRespCallback)(MqttClientContext *context)
PINGRESP message received callback.
Definition: mqtt_client.h:238
error_t mqttClientSetAuthInfo(MqttClientContext *context, const char_t *username, const char_t *password)
Set authentication information.
Definition: mqtt_client.c:356
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:393
void mqttClientInitCallbacks(MqttClientCallbacks *callbacks)
Initialize callback structure.
Definition: mqtt_client.c:102
error_t mqttClientRegisterPublishCallback(MqttClientContext *context, MqttClientPublishCallback callback)
Register publish callback function.
Definition: mqtt_client.c:209
Socket * socket
Underlying TCP socket.
Definition: mqtt_client.h:320
error_t mqttClientSetKeepAlive(MqttClientContext *context, uint16_t keepAlive)
Set keep-alive value.
Definition: mqtt_client.c:254
error_t mqttClientBindToInterface(MqttClientContext *context, NetInterface *interface)
Bind the MQTT client to a particular network interface.
Definition: mqtt_client.c:446
MqttClientPubAckCallback pubCompCallback
PUBCOMP message received callback.
Definition: mqtt_client.h:279
uint8_t cleanSession
#define Socket
Definition: socket.h:36
MqttClientState
MQTT client states.
Definition: mqtt_client.h:154
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:181
systime_t timeout
Communication timeout.
Definition: mqtt_client.h:298
void(* MqttClientUnsubAckCallback)(MqttClientContext *context, uint16_t packetId)
UNSUBACK message received callback.
Definition: mqtt_client.h:230
uint8_t message[]
Definition: chap.h:152
uint8_t buffer[MQTT_CLIENT_BUFFER_SIZE]
Internal buffer.
Definition: mqtt_client.h:330
TLS (Transport Layer Security)
uint8_t dup
Definition: mqtt_common.h:180
void(* MqttClientPubCompCallback)(MqttClientContext *context, uint16_t packetId)
PUBCOMP message received callback.
Definition: mqtt_client.h:214
#define MQTT_CLIENT_MAX_PASSWORD_LEN
Definition: mqtt_client.h:103
#define MqttClientContext
Definition: mqtt_client.h:142
MqttQosLevel qos
QoS level to be used when publishing the Will message.
Definition: mqtt_client.h:263
error_t mqttClientSubscribe(MqttClientContext *context, const char_t *topic, MqttQosLevel qos, uint16_t *packetId)
Subscribe to topic.
Definition: mqtt_client.c:738
char_t clientId[]
#define MQTT_CLIENT_MAX_WILL_PAYLOAD_LEN
Definition: mqtt_client.h:117
TCP/IP stack core.
#define MQTT_CLIENT_MAX_HOST_LEN
Definition: mqtt_client.h:75
error_t mqttClientSetHost(MqttClientContext *context, const char_t *host)
Set the domain name of the server (for virtual hosting)
Definition: mqtt_client.c:275
#define MQTT_CLIENT_BUFFER_SIZE
Definition: mqtt_client.h:124
error_t mqttClientDisconnect(MqttClientContext *context)
Gracefully disconnect from the MQTT server.
Definition: mqtt_client.c:1106
size_t packetPos
Current position.
Definition: mqtt_client.h:332
uint32_t systime_t
Definition: compiler_port.h:46
MqttPacketType
MQTT control packet type.
Definition: mqtt_common.h:98
error_t mqttClientRegisterCallbacks(MqttClientContext *context, const MqttClientCallbacks *callbacks)
Register MQTT client callbacks.
Definition: mqtt_client.c:116