| Paho Asynchronous MQTT C Client Library

Loading...
Searching...
No Matches
MQTTAsync.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (c) 2009, 2025 IBM Corp., Ian Craggs and others
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v2.0
6 * and Eclipse Distribution License v1.0 which accompany this distribution.
7 *
8 * The Eclipse Public License is available at
9 * https://www.eclipse.org/legal/epl-2.0/
10 * and the Eclipse Distribution License is available at
11 * http://www.eclipse.org/org/documents/edl-v10.php.
12 *
13 * Contributors:
14 * Ian Craggs - initial API and implementation
15 * Ian Craggs, Allan Stockdill-Mander - SSL connections
16 * Ian Craggs - multiple server connection support
17 * Ian Craggs - MQTT 3.1.1 support
18 * Ian Craggs - fix for bug 444103 - success/failure callbacks not invoked
19 * Ian Craggs - automatic reconnect and offline buffering (send while disconnected)
20 * Ian Craggs - binary will message
21 * Ian Craggs - binary password
22 * Ian Craggs - remove const on eyecatchers #168
23 * Ian Craggs - MQTT 5.0
24 *******************************************************************************/
25
26/********************************************************************/
27
87
88/*
90*/
91#if !defined(MQTTASYNC_H)
92#define MQTTASYNC_H
93
94#if defined(__cplusplus)
95 extern "C" {
96#endif
97
98#include <stdio.h>
99/*
101*/
102
103#include "MQTTExportDeclarations.h"
104
105#include "MQTTProperties.h"
106#include "MQTTReasonCodes.h"
107#include "MQTTSubscribeOpts.h"
108#if !defined(NO_PERSISTENCE)
109#include "MQTTClientPersistence.h"
110#else
111#define MQTTCLIENT_PERSISTENCE_NONE 1
112#endif
113
118#define MQTTASYNC_SUCCESS 0
123#define MQTTASYNC_FAILURE -1
124
125/* error code -2 is MQTTAsync_PERSISTENCE_ERROR */
126
127#define MQTTASYNC_PERSISTENCE_ERROR -2
128
132#define MQTTASYNC_DISCONNECTED -3
137#define MQTTASYNC_MAX_MESSAGES_INFLIGHT -4
141#define MQTTASYNC_BAD_UTF8_STRING -5
145#define MQTTASYNC_NULL_PARAMETER -6
151#define MQTTASYNC_TOPICNAME_TRUNCATED -7
156#define MQTTASYNC_BAD_STRUCTURE -8
160#define MQTTASYNC_BAD_QOS -9
164#define MQTTASYNC_NO_MORE_MSGIDS -10
168#define MQTTASYNC_OPERATION_INCOMPLETE -11
172#define MQTTASYNC_MAX_BUFFERED_MESSAGES -12
176#define MQTTASYNC_SSL_NOT_SUPPORTED -13
187#define MQTTASYNC_BAD_PROTOCOL -14
191#define MQTTASYNC_BAD_MQTT_OPTION -15
195#define MQTTASYNC_WRONG_MQTT_VERSION -16
199#define MQTTASYNC_0_LEN_WILL_TOPIC -17
200/*
201 * Return code: connect or disconnect command ignored because there is already a connect or disconnect
202 * command at the head of the list waiting to be processed. Use the onSuccess/onFailure callbacks to wait
203 * for the previous connect or disconnect command to be complete.
204 */
205#define MQTTASYNC_COMMAND_IGNORED -18
206 /*
207 * Return code: maxBufferedMessages in the connect options must be >= 0
208 */
209 #define MQTTASYNC_MAX_BUFFERED -19
210
214#define MQTTVERSION_DEFAULT 0
218#define MQTTVERSION_3_1 3
222#define MQTTVERSION_3_1_1 4
226#define MQTTVERSION_5 5
230#define MQTT_BAD_SUBSCRIBE 0x80
231
232
236 typedef struct
237{
239 char struct_id[4];
241 int struct_version;
243 int do_openssl_init;
244} MQTTAsync_init_options;
245
246#define MQTTAsync_init_options_initializer { {'M', 'Q', 'T', 'G'}, 0, 0 }
247
252LIBMQTT_API void MQTTAsync_global_init(MQTTAsync_init_options* inits);
253
258 typedef void* MQTTAsync;
268 typedef int MQTTAsync_token;
269
276 typedef struct
277{
279 char struct_id[4];
282 int struct_version;
284 int payloadlen;
286 void* payload;
300 int qos;
319 int retained;
326 int dup;
332 int msgid;
336 MQTTProperties properties;
337} MQTTAsync_message;
338
339#define MQTTAsync_message_initializer { {'M', 'Q', 'T', 'M'}, 1, 0, NULL, 0, 0, 0, 0, MQTTProperties_initializer }
340
374 typedef int MQTTAsync_messageArrived(void* context, char* topicName, int topicLen, MQTTAsync_message* message);
375
397 typedef void MQTTAsync_deliveryComplete(void* context, MQTTAsync_token token);
398
417 typedef void MQTTAsync_connectionLost(void* context, char* cause);
418
419
435 typedef void MQTTAsync_connected(void* context, char* cause);
436
448 typedef void MQTTAsync_disconnected(void* context, MQTTProperties* properties,
449 enum MQTTReasonCodes reasonCode);
450
466LIBMQTT_API int MQTTAsync_setDisconnected(MQTTAsync handle, void* context, MQTTAsync_disconnected* co);
467
469 typedef struct
470{
472 char struct_id[4];
474 int struct_version;
481 const char* username;
487 struct {
488 int len;
489 const void* data;
490 } binarypwd;
491} MQTTAsync_connectData;
492
493#define MQTTAsync_connectData_initializer {{'M', 'Q', 'C', 'D'}, 0, NULL, {0, NULL}}
494
501 typedef int MQTTAsync_updateConnectOptions(void* context, MQTTAsync_connectData* data);
502
512LIBMQTT_API int MQTTAsync_setUpdateConnectOptions(MQTTAsync handle, void* context, MQTTAsync_updateConnectOptions* co);
513
514#if !defined(NO_PERSISTENCE)
524LIBMQTT_API int MQTTAsync_setBeforePersistenceWrite(MQTTAsync handle, void* context, MQTTPersistence_beforeWrite* co);
525
526
536LIBMQTT_API int MQTTAsync_setAfterPersistenceRead(MQTTAsync handle, void* context, MQTTPersistence_afterRead* co);
537#endif
538
540 typedef struct
541{
543 MQTTAsync_token token;
545 int code;
547 const char *message;
548} MQTTAsync_failureData;
549
550
552 typedef struct
553{
555 char struct_id[4];
557 int struct_version;
559 MQTTAsync_token token;
561 enum MQTTReasonCodes reasonCode;
563 MQTTProperties properties;
565 int code;
567 const char *message;
569 int packet_type;
570} MQTTAsync_failureData5;
571
572#define MQTTAsync_failureData5_initializer {{'M', 'Q', 'F', 'D'}, 0, 0, MQTTREASONCODE_SUCCESS, MQTTProperties_initializer, 0, NULL, 0}
573
575 typedef struct
576{
578 MQTTAsync_token token;
580 union
581 {
584 int qos;
587 int* qosList;
589 struct
590 {
591 MQTTAsync_message message;
592 char* destinationName;
593 } pub;
594 /* For connect, the server connected to, MQTT version used, and sessionPresent flag */
595 struct
596 {
597 char* serverURI;
598 int MQTTVersion;
599 int sessionPresent;
600 } connect;
601 } alt;
602} MQTTAsync_successData;
603
604
606 typedef struct
607{
608 char struct_id[4];
609 int struct_version;
611 MQTTAsync_token token;
612 enum MQTTReasonCodes reasonCode;
613 MQTTProperties properties;
615 union
616 {
618 struct
619 {
620 int reasonCodeCount;
621 enum MQTTReasonCodes* reasonCodes;
622 } sub;
624 struct
625 {
626 MQTTAsync_message message;
627 char* destinationName;
628 } pub;
629 /* For connect, the server connected to, MQTT version used, and sessionPresent flag */
630 struct
631 {
632 char* serverURI;
633 int MQTTVersion;
634 int sessionPresent;
635 } connect;
637 struct
638 {
639 int reasonCodeCount;
640 enum MQTTReasonCodes* reasonCodes;
641 } unsub;
642 } alt;
643} MQTTAsync_successData5;
644
645#define MQTTAsync_successData5_initializer {{'M', 'Q', 'S', 'D'}, 0, 0, MQTTREASONCODE_SUCCESS, MQTTProperties_initializer, {.sub={0,0}}}
646
660 typedef void MQTTAsync_onSuccess(void* context, MQTTAsync_successData* response);
661
676 typedef void MQTTAsync_onSuccess5(void* context, MQTTAsync_successData5* response);
677
691 typedef void MQTTAsync_onFailure(void* context, MQTTAsync_failureData* response);
692
706 typedef void MQTTAsync_onFailure5(void* context, MQTTAsync_failureData5* response);
707
713 typedef struct MQTTAsync_responseOptions
714{
716 char struct_id[4];
719 int struct_version;
725 MQTTAsync_onSuccess* onSuccess;
731 MQTTAsync_onFailure* onFailure;
737 void* context;
744 MQTTAsync_token token;
750 MQTTAsync_onSuccess5* onSuccess5;
756 MQTTAsync_onFailure5* onFailure5;
760 MQTTProperties properties;
761 /*
762 * MQTT V5 subscribe options, when used with subscribe only.
763 */
764 MQTTSubscribe_options subscribeOptions;
765 /*
766 * MQTT V5 subscribe option count, when used with subscribeMany only.
767 * The number of entries in the subscribe_options_list array.
768 */
769 int subscribeOptionsCount;
770 /*
771 * MQTT V5 subscribe option array, when used with subscribeMany only.
772 */
773 MQTTSubscribe_options* subscribeOptionsList;
774} MQTTAsync_responseOptions;
775
776#define MQTTAsync_responseOptions_initializer { {'M', 'Q', 'T', 'R'}, 1, NULL, NULL, 0, 0, NULL, NULL, MQTTProperties_initializer, MQTTSubscribe_options_initializer, 0, NULL}
777
779 typedef struct MQTTAsync_responseOptions MQTTAsync_callOptions;
780#define MQTTAsync_callOptions_initializer MQTTAsync_responseOptions_initializer
781
810LIBMQTT_API int MQTTAsync_setCallbacks(MQTTAsync handle, void* context, MQTTAsync_connectionLost* cl,
811 MQTTAsync_messageArrived* ma, MQTTAsync_deliveryComplete* dc);
812
832
833LIBMQTT_API int MQTTAsync_setConnectionLostCallback(MQTTAsync handle, void* context,
834 MQTTAsync_connectionLost* cl);
835
857LIBMQTT_API int MQTTAsync_setMessageArrivedCallback(MQTTAsync handle, void* context,
858 MQTTAsync_messageArrived* ma);
859
879LIBMQTT_API int MQTTAsync_setDeliveryCompleteCallback(MQTTAsync handle, void* context,
880 MQTTAsync_deliveryComplete* dc);
881
894LIBMQTT_API int MQTTAsync_setConnected(MQTTAsync handle, void* context, MQTTAsync_connected* co);
895
896
905LIBMQTT_API int MQTTAsync_reconnect(MQTTAsync handle);
906
907
960LIBMQTT_API int MQTTAsync_create(MQTTAsync* handle, const char* serverURI, const char* clientId,
961 int persistence_type, void* persistence_context);
962
964 typedef struct
965{
967 char struct_id[4];
973 int struct_version;
975 int sendWhileDisconnected;
979 int maxBufferedMessages;
985 int MQTTVersion;
989 int allowDisconnectedSendAtAnyTime;
990 /*
991 * When the maximum number of buffered messages is reached, delete the oldest rather than the newest.
992 */
993 int deleteOldestMessages;
994 /*
995 * Restore messages from persistence on create - or clear it.
996 */
997 int restoreMessages;
998 /*
999 * Persist QoS0 publish commands - an option to not persist them.
1000 */
1001 int persistQoS0;
1002} MQTTAsync_createOptions;
1003
1004#define MQTTAsync_createOptions_initializer { {'M', 'Q', 'C', 'O'}, 2, 0, 100, MQTTVERSION_DEFAULT, 0, 0, 1, 1}
1005
1006#define MQTTAsync_createOptions_initializer5 { {'M', 'Q', 'C', 'O'}, 2, 0, 100, MQTTVERSION_5, 0, 0, 1, 1}
1007
1008
1009LIBMQTT_API int MQTTAsync_createWithOptions(MQTTAsync* handle, const char* serverURI, const char* clientId,
1010 int persistence_type, void* persistence_context, MQTTAsync_createOptions* options);
1011
1024 typedef struct
1025{
1027 char struct_id[4];
1031 int struct_version;
1033 const char* topicName;
1035 const char* message;
1039 int retained;
1044 int qos;
1046 struct
1047 {
1048 int len;
1049 const void* data;
1050 } payload;
1051} MQTTAsync_willOptions;
1052
1053#define MQTTAsync_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 1, NULL, NULL, 0, 0, { 0, NULL } }
1054
1055#define MQTT_SSL_VERSION_DEFAULT 0
1056#define MQTT_SSL_VERSION_TLS_1_0 1
1057#define MQTT_SSL_VERSION_TLS_1_1 2
1058#define MQTT_SSL_VERSION_TLS_1_2 3
1059
1072 typedef struct
1073{
1075 char struct_id[4];
1076
1084 int struct_version;
1085
1087 const char* trustStore;
1088
1092 const char* keyStore;
1093
1097 const char* privateKey;
1098
1100 const char* privateKeyPassword;
1101
1110 const char* enabledCipherSuites;
1111
1113 int enableServerCertAuth;
1114
1119 int sslVersion;
1120
1126 int verify;
1127
1133 const char* CApath;
1134
1139 int (*ssl_error_cb) (const char *str, size_t len, void *u);
1140
1145 void* ssl_error_context;
1146
1152 unsigned int (*ssl_psk_cb) (const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len, void *u);
1153
1158 void* ssl_psk_context;
1159
1165 int disableDefaultTrustStore;
1166
1174 const unsigned char *protos;
1175
1180 unsigned int protos_len;
1181} MQTTAsync_SSLOptions;
1182
1183#define MQTTAsync_SSLOptions_initializer { {'M', 'Q', 'T', 'S'}, 5, NULL, NULL, NULL, NULL, NULL, 1, MQTT_SSL_VERSION_DEFAULT, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0 }
1184
1186 typedef struct
1187{
1188 const char* name;
1189 const char* value;
1190} MQTTAsync_nameValue;
1191
1202 typedef struct
1203{
1205 char struct_id[4];
1216 int struct_version;
1227 int keepAliveInterval;
1249 int cleansession;
1253 int maxInflight;
1259 MQTTAsync_willOptions* will;
1265 const char* username;
1271 const char* password;
1275 int connectTimeout;
1283 int retryInterval;
1288 MQTTAsync_SSLOptions* ssl;
1294 MQTTAsync_onSuccess* onSuccess;
1300 MQTTAsync_onFailure* onFailure;
1306 void* context;
1310 int serverURIcount;
1322 char* const* serverURIs;
1329 int MQTTVersion;
1333 int automaticReconnect;
1337 int minRetryInterval;
1341 int maxRetryInterval;
1345 struct {
1346 int len;
1347 const void* data;
1348 } binarypwd;
1349 /*
1350 * MQTT V5 clean start flag. Only clears state at the beginning of the session.
1351 */
1352 int cleanstart;
1356 MQTTProperties *connectProperties;
1360 MQTTProperties *willProperties;
1366 MQTTAsync_onSuccess5* onSuccess5;
1372 MQTTAsync_onFailure5* onFailure5;
1376 const MQTTAsync_nameValue* httpHeaders;
1382 const char* httpProxy;
1386 const char* httpsProxy;
1387} MQTTAsync_connectOptions;
1388
1390#define MQTTAsync_connectOptions_initializer { {'M', 'Q', 'T', 'C'}, 8, 60, 1, 65535, NULL, NULL, NULL, 30, 0,\
1391 NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_DEFAULT, 0, 1, 60, {0, NULL}, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1392
1394#define MQTTAsync_connectOptions_initializer5 { {'M', 'Q', 'T', 'C'}, 8, 60, 0, 65535, NULL, NULL, NULL, 30, 0,\
1395 NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_5, 0, 1, 60, {0, NULL}, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1396
1400#define MQTTAsync_connectOptions_initializer_ws { {'M', 'Q', 'T', 'C'}, 8, 45, 1, 65535, NULL, NULL, NULL, 30, 0,\
1401 NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_DEFAULT, 0, 1, 60, {0, NULL}, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1402
1406#define MQTTAsync_connectOptions_initializer5_ws { {'M', 'Q', 'T', 'C'}, 8, 45, 0, 65535, NULL, NULL, NULL, 30, 0,\
1407 NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_5, 0, 1, 60, {0, NULL}, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1408
1409
1430LIBMQTT_API int MQTTAsync_connect(MQTTAsync handle, const MQTTAsync_connectOptions* options);
1431
1433 typedef struct
1434{
1436 char struct_id[4];
1438 int struct_version;
1443 int timeout;
1449 MQTTAsync_onSuccess* onSuccess;
1455 MQTTAsync_onFailure* onFailure;
1461 void* context;
1465 MQTTProperties properties;
1469 enum MQTTReasonCodes reasonCode;
1475 MQTTAsync_onSuccess5* onSuccess5;
1481 MQTTAsync_onFailure5* onFailure5;
1482} MQTTAsync_disconnectOptions;
1483
1484#define MQTTAsync_disconnectOptions_initializer { {'M', 'Q', 'T', 'D'}, 0, 0, NULL, NULL, NULL,\
1485 MQTTProperties_initializer, MQTTREASONCODE_SUCCESS, NULL, NULL }
1486
1487#define MQTTAsync_disconnectOptions_initializer5 { {'M', 'Q', 'T', 'D'}, 1, 0, NULL, NULL, NULL,\
1488 MQTTProperties_initializer, MQTTREASONCODE_SUCCESS, NULL, NULL }
1489
1508LIBMQTT_API int MQTTAsync_disconnect(MQTTAsync handle, const MQTTAsync_disconnectOptions* options);
1509
1510
1518LIBMQTT_API int MQTTAsync_isConnected(MQTTAsync handle);
1519
1520
1535LIBMQTT_API int MQTTAsync_subscribe(MQTTAsync handle, const char* topic, int qos, MQTTAsync_responseOptions* response);
1536
1537
1555LIBMQTT_API int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char* const* topic, const int* qos, MQTTAsync_responseOptions* response);
1556
1569LIBMQTT_API int MQTTAsync_unsubscribe(MQTTAsync handle, const char* topic, MQTTAsync_responseOptions* response);
1570
1583LIBMQTT_API int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char* const* topic, MQTTAsync_responseOptions* response);
1584
1585
1605LIBMQTT_API int MQTTAsync_send(MQTTAsync handle, const char* destinationName, int payloadlen, const void* payload, int qos,
1606 int retained, MQTTAsync_responseOptions* response);
1607
1624LIBMQTT_API int MQTTAsync_sendMessage(MQTTAsync handle, const char* destinationName, const MQTTAsync_message* msg, MQTTAsync_responseOptions* response);
1625
1626
1645LIBMQTT_API int MQTTAsync_getPendingTokens(MQTTAsync handle, MQTTAsync_token **tokens);
1646
1655#define MQTTASYNC_TRUE 1
1656LIBMQTT_API int MQTTAsync_isComplete(MQTTAsync handle, MQTTAsync_token token);
1657
1658
1671LIBMQTT_API int MQTTAsync_waitForCompletion(MQTTAsync handle, MQTTAsync_token token, unsigned long timeout);
1672
1673
1684LIBMQTT_API void MQTTAsync_freeMessage(MQTTAsync_message** msg);
1685
1694LIBMQTT_API void MQTTAsync_free(void* ptr);
1695
1703LIBMQTT_API void* MQTTAsync_malloc(size_t size);
1704
1712LIBMQTT_API void MQTTAsync_destroy(MQTTAsync* handle);
1713
1714
1715
1716 enum MQTTASYNC_TRACE_LEVELS
1717{
1718 MQTTASYNC_TRACE_MAXIMUM = 1,
1719 MQTTASYNC_TRACE_MEDIUM,
1720 MQTTASYNC_TRACE_MINIMUM,
1721 MQTTASYNC_TRACE_PROTOCOL,
1722 MQTTASYNC_TRACE_ERROR,
1723 MQTTASYNC_TRACE_SEVERE,
1724 MQTTASYNC_TRACE_FATAL,
1725};
1726
1727
1733LIBMQTT_API void MQTTAsync_setTraceLevel(enum MQTTASYNC_TRACE_LEVELS level);
1734
1735
1745 typedef void MQTTAsync_traceCallback(enum MQTTASYNC_TRACE_LEVELS level, char* message);
1746
1753LIBMQTT_API void MQTTAsync_setTraceCallback(MQTTAsync_traceCallback* callback);
1754
1761LIBMQTT_API MQTTAsync_nameValue* MQTTAsync_getVersionInfo(void);
1762
1769LIBMQTT_API const char* MQTTAsync_strerror(int code);
1770
1771
2399
2400#if defined(__cplusplus)
2401 }
2402#endif
2403
2404#endif
MQTTAsync_connect
int MQTTAsync_connect(MQTTAsync handle, const MQTTAsync_connectOptions *options)
MQTTAsync_unsubscribe
int MQTTAsync_unsubscribe(MQTTAsync handle, const char *topic, MQTTAsync_responseOptions *response)
MQTTAsync_setTraceCallback
void MQTTAsync_setTraceCallback(MQTTAsync_traceCallback *callback)
MQTTAsync
void * MQTTAsync
Definition MQTTAsync.h:258
MQTTAsync_setBeforePersistenceWrite
int MQTTAsync_setBeforePersistenceWrite(MQTTAsync handle, void *context, MQTTPersistence_beforeWrite *co)
MQTTAsync_global_init
void MQTTAsync_global_init(MQTTAsync_init_options *inits)
MQTTAsync_setConnected
int MQTTAsync_setConnected(MQTTAsync handle, void *context, MQTTAsync_connected *co)
MQTTAsync_free
void MQTTAsync_free(void *ptr)
MQTTAsync_connected
void MQTTAsync_connected(void *context, char *cause)
Definition MQTTAsync.h:435
MQTTAsync_connectionLost
void MQTTAsync_connectionLost(void *context, char *cause)
Definition MQTTAsync.h:417
MQTTAsync_messageArrived
int MQTTAsync_messageArrived(void *context, char *topicName, int topicLen, MQTTAsync_message *message)
Definition MQTTAsync.h:374
MQTTAsync_setMessageArrivedCallback
int MQTTAsync_setMessageArrivedCallback(MQTTAsync handle, void *context, MQTTAsync_messageArrived *ma)
MQTTAsync_isConnected
int MQTTAsync_isConnected(MQTTAsync handle)
MQTTAsync_waitForCompletion
int MQTTAsync_waitForCompletion(MQTTAsync handle, MQTTAsync_token token, unsigned long timeout)
MQTTAsync_disconnected
void MQTTAsync_disconnected(void *context, MQTTProperties *properties, enum MQTTReasonCodes reasonCode)
Definition MQTTAsync.h:448
MQTTAsync_create
int MQTTAsync_create(MQTTAsync *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context)
MQTTAsync_sendMessage
int MQTTAsync_sendMessage(MQTTAsync handle, const char *destinationName, const MQTTAsync_message *msg, MQTTAsync_responseOptions *response)
MQTTAsync_getVersionInfo
MQTTAsync_nameValue * MQTTAsync_getVersionInfo(void)
MQTTASYNC_TRACE_LEVELS
MQTTASYNC_TRACE_LEVELS
Definition MQTTAsync.h:1717
MQTTASYNC_TRACE_FATAL
@ MQTTASYNC_TRACE_FATAL
Definition MQTTAsync.h:1724
MQTTASYNC_TRACE_MEDIUM
@ MQTTASYNC_TRACE_MEDIUM
Definition MQTTAsync.h:1719
MQTTASYNC_TRACE_SEVERE
@ MQTTASYNC_TRACE_SEVERE
Definition MQTTAsync.h:1723
MQTTASYNC_TRACE_PROTOCOL
@ MQTTASYNC_TRACE_PROTOCOL
Definition MQTTAsync.h:1721
MQTTASYNC_TRACE_MINIMUM
@ MQTTASYNC_TRACE_MINIMUM
Definition MQTTAsync.h:1720
MQTTASYNC_TRACE_ERROR
@ MQTTASYNC_TRACE_ERROR
Definition MQTTAsync.h:1722
MQTTASYNC_TRACE_MAXIMUM
@ MQTTASYNC_TRACE_MAXIMUM
Definition MQTTAsync.h:1718
MQTTAsync_updateConnectOptions
int MQTTAsync_updateConnectOptions(void *context, MQTTAsync_connectData *data)
Definition MQTTAsync.h:501
MQTTAsync_onFailure
void MQTTAsync_onFailure(void *context, MQTTAsync_failureData *response)
Definition MQTTAsync.h:691
MQTTAsync_send
int MQTTAsync_send(MQTTAsync handle, const char *destinationName, int payloadlen, const void *payload, int qos, int retained, MQTTAsync_responseOptions *response)
MQTTAsync_traceCallback
void MQTTAsync_traceCallback(enum MQTTASYNC_TRACE_LEVELS level, char *message)
Definition MQTTAsync.h:1745
MQTTAsync_unsubscribeMany
int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char *const *topic, MQTTAsync_responseOptions *response)
MQTTAsync_createWithOptions
int MQTTAsync_createWithOptions(MQTTAsync *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context, MQTTAsync_createOptions *options)
MQTTAsync_onSuccess
void MQTTAsync_onSuccess(void *context, MQTTAsync_successData *response)
Definition MQTTAsync.h:660
MQTTAsync_token
int MQTTAsync_token
Definition MQTTAsync.h:268
MQTTAsync_strerror
const char * MQTTAsync_strerror(int code)
MQTTAsync_onSuccess5
void MQTTAsync_onSuccess5(void *context, MQTTAsync_successData5 *response)
Definition MQTTAsync.h:676
MQTTAsync_malloc
void * MQTTAsync_malloc(size_t size)
MQTTAsync_onFailure5
void MQTTAsync_onFailure5(void *context, MQTTAsync_failureData5 *response)
Definition MQTTAsync.h:706
MQTTAsync_setDeliveryCompleteCallback
int MQTTAsync_setDeliveryCompleteCallback(MQTTAsync handle, void *context, MQTTAsync_deliveryComplete *dc)
MQTTAsync_freeMessage
void MQTTAsync_freeMessage(MQTTAsync_message **msg)
MQTTAsync_setUpdateConnectOptions
int MQTTAsync_setUpdateConnectOptions(MQTTAsync handle, void *context, MQTTAsync_updateConnectOptions *co)
MQTTAsync_deliveryComplete
void MQTTAsync_deliveryComplete(void *context, MQTTAsync_token token)
Definition MQTTAsync.h:397
MQTTAsync_isComplete
int MQTTAsync_isComplete(MQTTAsync handle, MQTTAsync_token token)
MQTTAsync_setAfterPersistenceRead
int MQTTAsync_setAfterPersistenceRead(MQTTAsync handle, void *context, MQTTPersistence_afterRead *co)
MQTTAsync_callOptions
struct MQTTAsync_responseOptions MQTTAsync_callOptions
Definition MQTTAsync.h:779
MQTTAsync_getPendingTokens
int MQTTAsync_getPendingTokens(MQTTAsync handle, MQTTAsync_token **tokens)
MQTTAsync_reconnect
int MQTTAsync_reconnect(MQTTAsync handle)
MQTTAsync_subscribeMany
int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char *const *topic, const int *qos, MQTTAsync_responseOptions *response)
MQTTAsync_setTraceLevel
void MQTTAsync_setTraceLevel(enum MQTTASYNC_TRACE_LEVELS level)
MQTTAsync_destroy
void MQTTAsync_destroy(MQTTAsync *handle)
MQTTAsync_setDisconnected
int MQTTAsync_setDisconnected(MQTTAsync handle, void *context, MQTTAsync_disconnected *co)
MQTTAsync_disconnect
int MQTTAsync_disconnect(MQTTAsync handle, const MQTTAsync_disconnectOptions *options)
MQTTAsync_subscribe
int MQTTAsync_subscribe(MQTTAsync handle, const char *topic, int qos, MQTTAsync_responseOptions *response)
MQTTAsync_setCallbacks
int MQTTAsync_setCallbacks(MQTTAsync handle, void *context, MQTTAsync_connectionLost *cl, MQTTAsync_messageArrived *ma, MQTTAsync_deliveryComplete *dc)
MQTTAsync_setConnectionLostCallback
int MQTTAsync_setConnectionLostCallback(MQTTAsync handle, void *context, MQTTAsync_connectionLost *cl)
MQTTClientPersistence.h
This structure represents a persistent data store, used to store outbound and inbound messages,...
MQTTPersistence_beforeWrite
int MQTTPersistence_beforeWrite(void *context, int bufcount, char *buffers[], int buflens[])
Definition MQTTClientPersistence.h:264
MQTTPersistence_afterRead
int MQTTPersistence_afterRead(void *context, char **buffer, int *buflen)
Definition MQTTClientPersistence.h:275
MQTTProperties.h
MQTTReasonCodes.h
MQTTReasonCodes
MQTTReasonCodes
Definition MQTTReasonCodes.h:23
MQTTSubscribeOpts.h
MQTTAsync_SSLOptions
Definition MQTTAsync.h:1073
MQTTAsync_SSLOptions::trustStore
const char * trustStore
Definition MQTTAsync.h:1087
MQTTAsync_SSLOptions::struct_version
int struct_version
Definition MQTTAsync.h:1084
MQTTAsync_SSLOptions::disableDefaultTrustStore
int disableDefaultTrustStore
Definition MQTTAsync.h:1165
MQTTAsync_SSLOptions::ssl_error_context
void * ssl_error_context
Definition MQTTAsync.h:1145
MQTTAsync_SSLOptions::ssl_error_cb
int(* ssl_error_cb)(const char *str, size_t len, void *u)
Definition MQTTAsync.h:1139
MQTTAsync_SSLOptions::protos_len
unsigned int protos_len
Definition MQTTAsync.h:1180
MQTTAsync_SSLOptions::CApath
const char * CApath
Definition MQTTAsync.h:1133
MQTTAsync_SSLOptions::keyStore
const char * keyStore
Definition MQTTAsync.h:1092
MQTTAsync_SSLOptions::sslVersion
int sslVersion
Definition MQTTAsync.h:1119
MQTTAsync_SSLOptions::protos
const unsigned char * protos
Definition MQTTAsync.h:1174
MQTTAsync_SSLOptions::enableServerCertAuth
int enableServerCertAuth
Definition MQTTAsync.h:1113
MQTTAsync_SSLOptions::privateKey
const char * privateKey
Definition MQTTAsync.h:1097
MQTTAsync_SSLOptions::ssl_psk_cb
unsigned int(* ssl_psk_cb)(const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len, void *u)
Definition MQTTAsync.h:1152
MQTTAsync_SSLOptions::verify
int verify
Definition MQTTAsync.h:1126
MQTTAsync_SSLOptions::struct_id
char struct_id[4]
Definition MQTTAsync.h:1075
MQTTAsync_SSLOptions::enabledCipherSuites
const char * enabledCipherSuites
Definition MQTTAsync.h:1110
MQTTAsync_SSLOptions::ssl_psk_context
void * ssl_psk_context
Definition MQTTAsync.h:1158
MQTTAsync_SSLOptions::privateKeyPassword
const char * privateKeyPassword
Definition MQTTAsync.h:1100
MQTTAsync_connectData
Definition MQTTAsync.h:470
MQTTAsync_connectData::struct_version
int struct_version
Definition MQTTAsync.h:474
MQTTAsync_connectData::data
const void * data
Definition MQTTAsync.h:489
MQTTAsync_connectData::struct_id
char struct_id[4]
Definition MQTTAsync.h:472
MQTTAsync_connectData::username
const char * username
Definition MQTTAsync.h:481
MQTTAsync_connectData::len
int len
Definition MQTTAsync.h:488
MQTTAsync_connectOptions
Definition MQTTAsync.h:1203
MQTTAsync_connectOptions::maxRetryInterval
int maxRetryInterval
Definition MQTTAsync.h:1341
MQTTAsync_connectOptions::cleansession
int cleansession
Definition MQTTAsync.h:1249
MQTTAsync_connectOptions::struct_version
int struct_version
Definition MQTTAsync.h:1216
MQTTAsync_connectOptions::onFailure
MQTTAsync_onFailure * onFailure
Definition MQTTAsync.h:1300
MQTTAsync_connectOptions::data
const void * data
Definition MQTTAsync.h:1347
MQTTAsync_connectOptions::MQTTVersion
int MQTTVersion
Definition MQTTAsync.h:1329
MQTTAsync_connectOptions::minRetryInterval
int minRetryInterval
Definition MQTTAsync.h:1337
MQTTAsync_connectOptions::onSuccess5
MQTTAsync_onSuccess5 * onSuccess5
Definition MQTTAsync.h:1366
MQTTAsync_connectOptions::httpsProxy
const char * httpsProxy
Definition MQTTAsync.h:1386
MQTTAsync_connectOptions::connectTimeout
int connectTimeout
Definition MQTTAsync.h:1275
MQTTAsync_connectOptions::onFailure5
MQTTAsync_onFailure5 * onFailure5
Definition MQTTAsync.h:1372
MQTTAsync_connectOptions::maxInflight
int maxInflight
Definition MQTTAsync.h:1253
MQTTAsync_connectOptions::automaticReconnect
int automaticReconnect
Definition MQTTAsync.h:1333
MQTTAsync_connectOptions::will
MQTTAsync_willOptions * will
Definition MQTTAsync.h:1259
MQTTAsync_connectOptions::ssl
MQTTAsync_SSLOptions * ssl
Definition MQTTAsync.h:1288
MQTTAsync_connectOptions::connectProperties
MQTTProperties * connectProperties
Definition MQTTAsync.h:1356
MQTTAsync_connectOptions::password
const char * password
Definition MQTTAsync.h:1271
MQTTAsync_connectOptions::struct_id
char struct_id[4]
Definition MQTTAsync.h:1205
MQTTAsync_connectOptions::serverURIcount
int serverURIcount
Definition MQTTAsync.h:1310
MQTTAsync_connectOptions::serverURIs
char *const * serverURIs
Definition MQTTAsync.h:1322
MQTTAsync_connectOptions::username
const char * username
Definition MQTTAsync.h:1265
MQTTAsync_connectOptions::onSuccess
MQTTAsync_onSuccess * onSuccess
Definition MQTTAsync.h:1294
MQTTAsync_connectOptions::willProperties
MQTTProperties * willProperties
Definition MQTTAsync.h:1360
MQTTAsync_connectOptions::httpHeaders
const MQTTAsync_nameValue * httpHeaders
Definition MQTTAsync.h:1376
MQTTAsync_connectOptions::retryInterval
int retryInterval
Definition MQTTAsync.h:1283
MQTTAsync_connectOptions::keepAliveInterval
int keepAliveInterval
Definition MQTTAsync.h:1227
MQTTAsync_connectOptions::cleanstart
int cleanstart
Definition MQTTAsync.h:1352
MQTTAsync_connectOptions::httpProxy
const char * httpProxy
Definition MQTTAsync.h:1382
MQTTAsync_connectOptions::context
void * context
Definition MQTTAsync.h:1306
MQTTAsync_connectOptions::len
int len
Definition MQTTAsync.h:1346
MQTTAsync_createOptions
Definition MQTTAsync.h:965
MQTTAsync_createOptions::struct_version
int struct_version
Definition MQTTAsync.h:973
MQTTAsync_createOptions::sendWhileDisconnected
int sendWhileDisconnected
Definition MQTTAsync.h:975
MQTTAsync_createOptions::persistQoS0
int persistQoS0
Definition MQTTAsync.h:1001
MQTTAsync_createOptions::MQTTVersion
int MQTTVersion
Definition MQTTAsync.h:985
MQTTAsync_createOptions::restoreMessages
int restoreMessages
Definition MQTTAsync.h:997
MQTTAsync_createOptions::maxBufferedMessages
int maxBufferedMessages
Definition MQTTAsync.h:979
MQTTAsync_createOptions::deleteOldestMessages
int deleteOldestMessages
Definition MQTTAsync.h:993
MQTTAsync_createOptions::struct_id
char struct_id[4]
Definition MQTTAsync.h:967
MQTTAsync_createOptions::allowDisconnectedSendAtAnyTime
int allowDisconnectedSendAtAnyTime
Definition MQTTAsync.h:989
MQTTAsync_disconnectOptions
Definition MQTTAsync.h:1434
MQTTAsync_disconnectOptions::struct_version
int struct_version
Definition MQTTAsync.h:1438
MQTTAsync_disconnectOptions::onFailure
MQTTAsync_onFailure * onFailure
Definition MQTTAsync.h:1455
MQTTAsync_disconnectOptions::properties
MQTTProperties properties
Definition MQTTAsync.h:1465
MQTTAsync_disconnectOptions::onSuccess5
MQTTAsync_onSuccess5 * onSuccess5
Definition MQTTAsync.h:1475
MQTTAsync_disconnectOptions::timeout
int timeout
Definition MQTTAsync.h:1443
MQTTAsync_disconnectOptions::onFailure5
MQTTAsync_onFailure5 * onFailure5
Definition MQTTAsync.h:1481
MQTTAsync_disconnectOptions::reasonCode
enum MQTTReasonCodes reasonCode
Definition MQTTAsync.h:1469
MQTTAsync_disconnectOptions::struct_id
char struct_id[4]
Definition MQTTAsync.h:1436
MQTTAsync_disconnectOptions::onSuccess
MQTTAsync_onSuccess * onSuccess
Definition MQTTAsync.h:1449
MQTTAsync_disconnectOptions::context
void * context
Definition MQTTAsync.h:1461
MQTTAsync_failureData5
Definition MQTTAsync.h:553
MQTTAsync_failureData5::struct_version
int struct_version
Definition MQTTAsync.h:557
MQTTAsync_failureData5::properties
MQTTProperties properties
Definition MQTTAsync.h:563
MQTTAsync_failureData5::message
const char * message
Definition MQTTAsync.h:567
MQTTAsync_failureData5::packet_type
int packet_type
Definition MQTTAsync.h:569
MQTTAsync_failureData5::code
int code
Definition MQTTAsync.h:565
MQTTAsync_failureData5::reasonCode
enum MQTTReasonCodes reasonCode
Definition MQTTAsync.h:561
MQTTAsync_failureData5::struct_id
char struct_id[4]
Definition MQTTAsync.h:555
MQTTAsync_failureData5::token
MQTTAsync_token token
Definition MQTTAsync.h:559
MQTTAsync_failureData
Definition MQTTAsync.h:541
MQTTAsync_failureData::message
const char * message
Definition MQTTAsync.h:547
MQTTAsync_failureData::code
int code
Definition MQTTAsync.h:545
MQTTAsync_failureData::token
MQTTAsync_token token
Definition MQTTAsync.h:543
MQTTAsync_init_options
Definition MQTTAsync.h:237
MQTTAsync_init_options::struct_version
int struct_version
Definition MQTTAsync.h:241
MQTTAsync_init_options::do_openssl_init
int do_openssl_init
Definition MQTTAsync.h:243
MQTTAsync_init_options::struct_id
char struct_id[4]
Definition MQTTAsync.h:239
MQTTAsync_message
Definition MQTTAsync.h:277
MQTTAsync_message::struct_version
int struct_version
Definition MQTTAsync.h:282
MQTTAsync_message::properties
MQTTProperties properties
Definition MQTTAsync.h:336
MQTTAsync_message::qos
int qos
Definition MQTTAsync.h:300
MQTTAsync_message::msgid
int msgid
Definition MQTTAsync.h:332
MQTTAsync_message::retained
int retained
Definition MQTTAsync.h:319
MQTTAsync_message::payload
void * payload
Definition MQTTAsync.h:286
MQTTAsync_message::payloadlen
int payloadlen
Definition MQTTAsync.h:284
MQTTAsync_message::struct_id
char struct_id[4]
Definition MQTTAsync.h:279
MQTTAsync_message::dup
int dup
Definition MQTTAsync.h:326
MQTTAsync_nameValue
Definition MQTTAsync.h:1187
MQTTAsync_nameValue::value
const char * value
Definition MQTTAsync.h:1189
MQTTAsync_nameValue::name
const char * name
Definition MQTTAsync.h:1188
MQTTAsync_responseOptions
Definition MQTTAsync.h:714
MQTTAsync_responseOptions::struct_version
int struct_version
Definition MQTTAsync.h:719
MQTTAsync_responseOptions::onFailure
MQTTAsync_onFailure * onFailure
Definition MQTTAsync.h:731
MQTTAsync_responseOptions::properties
MQTTProperties properties
Definition MQTTAsync.h:760
MQTTAsync_responseOptions::subscribeOptions
MQTTSubscribe_options subscribeOptions
Definition MQTTAsync.h:764
MQTTAsync_responseOptions::subscribeOptionsCount
int subscribeOptionsCount
Definition MQTTAsync.h:769
MQTTAsync_responseOptions::onSuccess5
MQTTAsync_onSuccess5 * onSuccess5
Definition MQTTAsync.h:750
MQTTAsync_responseOptions::onFailure5
MQTTAsync_onFailure5 * onFailure5
Definition MQTTAsync.h:756
MQTTAsync_responseOptions::subscribeOptionsList
MQTTSubscribe_options * subscribeOptionsList
Definition MQTTAsync.h:773
MQTTAsync_responseOptions::struct_id
char struct_id[4]
Definition MQTTAsync.h:716
MQTTAsync_responseOptions::onSuccess
MQTTAsync_onSuccess * onSuccess
Definition MQTTAsync.h:725
MQTTAsync_responseOptions::context
void * context
Definition MQTTAsync.h:737
MQTTAsync_responseOptions::token
MQTTAsync_token token
Definition MQTTAsync.h:744
MQTTAsync_successData5
Definition MQTTAsync.h:607
MQTTAsync_successData5::struct_version
int struct_version
Definition MQTTAsync.h:609
MQTTAsync_successData5::MQTTVersion
int MQTTVersion
Definition MQTTAsync.h:633
MQTTAsync_successData5::properties
MQTTProperties properties
Definition MQTTAsync.h:613
MQTTAsync_successData5::reasonCodes
enum MQTTReasonCodes * reasonCodes
Definition MQTTAsync.h:621
MQTTAsync_successData5::sessionPresent
int sessionPresent
Definition MQTTAsync.h:634
MQTTAsync_successData5::reasonCode
enum MQTTReasonCodes reasonCode
Definition MQTTAsync.h:612
MQTTAsync_successData5::message
MQTTAsync_message message
Definition MQTTAsync.h:626
MQTTAsync_successData5::serverURI
char * serverURI
Definition MQTTAsync.h:632
MQTTAsync_successData5::struct_id
char struct_id[4]
Definition MQTTAsync.h:608
MQTTAsync_successData5::reasonCodeCount
int reasonCodeCount
Definition MQTTAsync.h:620
MQTTAsync_successData5::destinationName
char * destinationName
Definition MQTTAsync.h:627
MQTTAsync_successData5::token
MQTTAsync_token token
Definition MQTTAsync.h:611
MQTTAsync_successData
Definition MQTTAsync.h:576
MQTTAsync_successData::MQTTVersion
int MQTTVersion
Definition MQTTAsync.h:598
MQTTAsync_successData::qos
int qos
Definition MQTTAsync.h:584
MQTTAsync_successData::sessionPresent
int sessionPresent
Definition MQTTAsync.h:599
MQTTAsync_successData::message
MQTTAsync_message message
Definition MQTTAsync.h:591
MQTTAsync_successData::qosList
int * qosList
Definition MQTTAsync.h:587
MQTTAsync_successData::serverURI
char * serverURI
Definition MQTTAsync.h:597
MQTTAsync_successData::destinationName
char * destinationName
Definition MQTTAsync.h:592
MQTTAsync_successData::token
MQTTAsync_token token
Definition MQTTAsync.h:578
MQTTAsync_willOptions
Definition MQTTAsync.h:1025
MQTTAsync_willOptions::struct_version
int struct_version
Definition MQTTAsync.h:1031
MQTTAsync_willOptions::data
const void * data
Definition MQTTAsync.h:1049
MQTTAsync_willOptions::topicName
const char * topicName
Definition MQTTAsync.h:1033
MQTTAsync_willOptions::message
const char * message
Definition MQTTAsync.h:1035
MQTTAsync_willOptions::qos
int qos
Definition MQTTAsync.h:1044
MQTTAsync_willOptions::retained
int retained
Definition MQTTAsync.h:1039
MQTTAsync_willOptions::struct_id
char struct_id[4]
Definition MQTTAsync.h:1027
MQTTAsync_willOptions::len
int len
Definition MQTTAsync.h:1048
MQTTProperties
Definition MQTTProperties.h:116
MQTTSubscribe_options
Definition MQTTSubscribeOpts.h:22