Paho Asynchronous MQTT C Client Library: MQTTAsync.h Source File

| Paho Asynchronous MQTT C Client Library

MQTTAsync.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (c) 2009, 2022 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
85 /*
87 */
88 #if !defined(MQTTASYNC_H)
89 #define MQTTASYNC_H
90
91 #if defined(__cplusplus)
92 extern "C" {
93 #endif
94
95 #include <stdio.h>
96 /*
98 */
99
100 #include "MQTTExportDeclarations.h"
101
102 #include "MQTTProperties.h"
103 #include "MQTTReasonCodes.h"
104 #include "MQTTSubscribeOpts.h"
105 #if !defined(NO_PERSISTENCE)
106 #include "MQTTClientPersistence.h"
107 #endif
108
113 #define MQTTASYNC_SUCCESS 0
118 #define MQTTASYNC_FAILURE -1
119
120 /* error code -2 is MQTTAsync_PERSISTENCE_ERROR */
121
122 #define MQTTASYNC_PERSISTENCE_ERROR -2
123
127 #define MQTTASYNC_DISCONNECTED -3
132 #define MQTTASYNC_MAX_MESSAGES_INFLIGHT -4
136 #define MQTTASYNC_BAD_UTF8_STRING -5
140 #define MQTTASYNC_NULL_PARAMETER -6
146 #define MQTTASYNC_TOPICNAME_TRUNCATED -7
151 #define MQTTASYNC_BAD_STRUCTURE -8
155 #define MQTTASYNC_BAD_QOS -9
159 #define MQTTASYNC_NO_MORE_MSGIDS -10
163 #define MQTTASYNC_OPERATION_INCOMPLETE -11
167 #define MQTTASYNC_MAX_BUFFERED_MESSAGES -12
171 #define MQTTASYNC_SSL_NOT_SUPPORTED -13
182 #define MQTTASYNC_BAD_PROTOCOL -14
186 #define MQTTASYNC_BAD_MQTT_OPTION -15
190 #define MQTTASYNC_WRONG_MQTT_VERSION -16
194 #define MQTTASYNC_0_LEN_WILL_TOPIC -17
195 /*
196 * Return code: connect or disconnect command ignored because there is already a connect or disconnect
197 * command at the head of the list waiting to be processed. Use the onSuccess/onFailure callbacks to wait
198 * for the previous connect or disconnect command to be complete.
199 */
200 #define MQTTASYNC_COMMAND_IGNORED -18
201 /*
202 * Return code: maxBufferedMessages in the connect options must be >= 0
203 */
204 #define MQTTASYNC_MAX_BUFFERED -19
205
209 #define MQTTVERSION_DEFAULT 0
213 #define MQTTVERSION_3_1 3
217 #define MQTTVERSION_3_1_1 4
221 #define MQTTVERSION_5 5
225 #define MQTT_BAD_SUBSCRIBE 0x80
226
227
231 typedef struct
232 {
234 char struct_id[4];
236 int struct_version;
238 int do_openssl_init;
239 } MQTTAsync_init_options;
240
241 #define MQTTAsync_init_options_initializer { {'M', 'Q', 'T', 'G'}, 0, 0 }
242
247 LIBMQTT_API void MQTTAsync_global_init(MQTTAsync_init_options* inits);
248
253 typedef void* MQTTAsync;
263 typedef int MQTTAsync_token;
264
271 typedef struct
272 {
274 char struct_id[4];
277 int struct_version;
279 int payloadlen;
281 void* payload;
295 int qos;
314 int retained;
321 int dup;
327 int msgid;
331 MQTTProperties properties;
332 } MQTTAsync_message;
333
334 #define MQTTAsync_message_initializer { {'M', 'Q', 'T', 'M'}, 1, 0, NULL, 0, 0, 0, 0, MQTTProperties_initializer }
335
369 typedef int MQTTAsync_messageArrived(void* context, char* topicName, int topicLen, MQTTAsync_message* message);
370
392 typedef void MQTTAsync_deliveryComplete(void* context, MQTTAsync_token token);
393
412 typedef void MQTTAsync_connectionLost(void* context, char* cause);
413
414
430 typedef void MQTTAsync_connected(void* context, char* cause);
431
444 typedef void MQTTAsync_disconnected(void* context, MQTTProperties* properties,
445 enum MQTTReasonCodes reasonCode);
446
462 LIBMQTT_API int MQTTAsync_setDisconnected(MQTTAsync handle, void* context, MQTTAsync_disconnected* co);
463
465 typedef struct
466 {
468 char struct_id[4];
470 int struct_version;
477 const char* username;
483 struct {
484 int len;
485 const void* data;
486 } binarypwd;
487 } MQTTAsync_connectData;
488
489 #define MQTTAsync_connectData_initializer {{'M', 'Q', 'C', 'D'}, 0, NULL, {0, NULL}}
490
497 typedef int MQTTAsync_updateConnectOptions(void* context, MQTTAsync_connectData* data);
498
508 LIBMQTT_API int MQTTAsync_setUpdateConnectOptions(MQTTAsync handle, void* context, MQTTAsync_updateConnectOptions* co);
509
519 LIBMQTT_API int MQTTAsync_setBeforePersistenceWrite(MQTTAsync handle, void* context, MQTTPersistence_beforeWrite* co);
520
521
531 LIBMQTT_API int MQTTAsync_setAfterPersistenceRead(MQTTAsync handle, void* context, MQTTPersistence_afterRead* co);
532
533
535 typedef struct
536 {
538 MQTTAsync_token token;
540 int code;
542 const char *message;
543 } MQTTAsync_failureData;
544
545
547 typedef struct
548 {
550 char struct_id[4];
552 int struct_version;
554 MQTTAsync_token token;
556 enum MQTTReasonCodes reasonCode;
558 MQTTProperties properties;
560 int code;
562 const char *message;
564 int packet_type;
565 } MQTTAsync_failureData5;
566
567 #define MQTTAsync_failureData5_initializer {{'M', 'Q', 'F', 'D'}, 0, 0, MQTTREASONCODE_SUCCESS, MQTTProperties_initializer, 0, NULL, 0}
568
570 typedef struct
571 {
573 MQTTAsync_token token;
575 union
576 {
579 int qos;
582 int* qosList;
584 struct
585 {
586 MQTTAsync_message message;
587 char* destinationName;
588 } pub;
589 /* For connect, the server connected to, MQTT version used, and sessionPresent flag */
590 struct
591 {
592 char* serverURI;
593 int MQTTVersion;
594 int sessionPresent;
595 } connect;
596 } alt;
597 } MQTTAsync_successData;
598
599
601 typedef struct
602 {
603 char struct_id[4];
604 int struct_version;
606 MQTTAsync_token token;
607 enum MQTTReasonCodes reasonCode;
608 MQTTProperties properties;
610 union
611 {
613 struct
614 {
615 int reasonCodeCount;
616 enum MQTTReasonCodes* reasonCodes;
617 } sub;
619 struct
620 {
621 MQTTAsync_message message;
622 char* destinationName;
623 } pub;
624 /* For connect, the server connected to, MQTT version used, and sessionPresent flag */
625 struct
626 {
627 char* serverURI;
628 int MQTTVersion;
629 int sessionPresent;
630 } connect;
632 struct
633 {
634 int reasonCodeCount;
635 enum MQTTReasonCodes* reasonCodes;
636 } unsub;
637 } alt;
638 } MQTTAsync_successData5;
639
640 #define MQTTAsync_successData5_initializer {{'M', 'Q', 'S', 'D'}, 0, 0, MQTTREASONCODE_SUCCESS, MQTTProperties_initializer, {.sub={0,0}}}
641
655 typedef void MQTTAsync_onSuccess(void* context, MQTTAsync_successData* response);
656
671 typedef void MQTTAsync_onSuccess5(void* context, MQTTAsync_successData5* response);
672
686 typedef void MQTTAsync_onFailure(void* context, MQTTAsync_failureData* response);
687
701 typedef void MQTTAsync_onFailure5(void* context, MQTTAsync_failureData5* response);
702
708 typedef struct MQTTAsync_responseOptions
709 {
711 char struct_id[4];
714 int struct_version;
720 MQTTAsync_onSuccess* onSuccess;
726 MQTTAsync_onFailure* onFailure;
732 void* context;
739 MQTTAsync_token token;
745 MQTTAsync_onSuccess5* onSuccess5;
751 MQTTAsync_onFailure5* onFailure5;
755 MQTTProperties properties;
756 /*
757 * MQTT V5 subscribe options, when used with subscribe only.
758 */
759 MQTTSubscribe_options subscribeOptions;
760 /*
761 * MQTT V5 subscribe option count, when used with subscribeMany only.
762 * The number of entries in the subscribe_options_list array.
763 */
764 int subscribeOptionsCount;
765 /*
766 * MQTT V5 subscribe option array, when used with subscribeMany only.
767 */
768 MQTTSubscribe_options* subscribeOptionsList;
769 } MQTTAsync_responseOptions;
770
771 #define MQTTAsync_responseOptions_initializer { {'M', 'Q', 'T', 'R'}, 1, NULL, NULL, 0, 0, NULL, NULL, MQTTProperties_initializer, MQTTSubscribe_options_initializer, 0, NULL}
772
774 typedef struct MQTTAsync_responseOptions MQTTAsync_callOptions;
775 #define MQTTAsync_callOptions_initializer MQTTAsync_responseOptions_initializer
776
806 LIBMQTT_API int MQTTAsync_setCallbacks(MQTTAsync handle, void* context, MQTTAsync_connectionLost* cl,
807 MQTTAsync_messageArrived* ma, MQTTAsync_deliveryComplete* dc);
808
829 LIBMQTT_API int MQTTAsync_setConnectionLostCallback(MQTTAsync handle, void* context,
830 MQTTAsync_connectionLost* cl);
831
853 LIBMQTT_API int MQTTAsync_setMessageArrivedCallback(MQTTAsync handle, void* context,
854 MQTTAsync_messageArrived* ma);
855
875 LIBMQTT_API int MQTTAsync_setDeliveryCompleteCallback(MQTTAsync handle, void* context,
876 MQTTAsync_deliveryComplete* dc);
877
890 LIBMQTT_API int MQTTAsync_setConnected(MQTTAsync handle, void* context, MQTTAsync_connected* co);
891
892
901 LIBMQTT_API int MQTTAsync_reconnect(MQTTAsync handle);
902
903
956 LIBMQTT_API int MQTTAsync_create(MQTTAsync* handle, const char* serverURI, const char* clientId,
957 int persistence_type, void* persistence_context);
958
960 typedef struct
961 {
963 char struct_id[4];
969 int struct_version;
971 int sendWhileDisconnected;
975 int maxBufferedMessages;
981 int MQTTVersion;
985 int allowDisconnectedSendAtAnyTime;
986 /*
987 * When the maximum number of buffered messages is reached, delete the oldest rather than the newest.
988 */
989 int deleteOldestMessages;
990 /*
991 * Restore messages from persistence on create - or clear it.
992 */
993 int restoreMessages;
994 /*
995 * Persist QoS0 publish commands - an option to not persist them.
996 */
997 int persistQoS0;
998 } MQTTAsync_createOptions;
999
1000 #define MQTTAsync_createOptions_initializer { {'M', 'Q', 'C', 'O'}, 2, 0, 100, MQTTVERSION_DEFAULT, 0, 0, 1, 1}
1001
1002 #define MQTTAsync_createOptions_initializer5 { {'M', 'Q', 'C', 'O'}, 2, 0, 100, MQTTVERSION_5, 0, 0, 1, 1}
1003
1004
1005 LIBMQTT_API int MQTTAsync_createWithOptions(MQTTAsync* handle, const char* serverURI, const char* clientId,
1006 int persistence_type, void* persistence_context, MQTTAsync_createOptions* options);
1007
1020 typedef struct
1021 {
1023 char struct_id[4];
1027 int struct_version;
1029 const char* topicName;
1031 const char* message;
1035 int retained;
1040 int qos;
1042 struct
1043 {
1044 int len;
1045 const void* data;
1046 } payload;
1047 } MQTTAsync_willOptions;
1048
1049 #define MQTTAsync_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 1, NULL, NULL, 0, 0, { 0, NULL } }
1050
1051 #define MQTT_SSL_VERSION_DEFAULT 0
1052 #define MQTT_SSL_VERSION_TLS_1_0 1
1053 #define MQTT_SSL_VERSION_TLS_1_1 2
1054 #define MQTT_SSL_VERSION_TLS_1_2 3
1055
1068 typedef struct
1069 {
1071 char struct_id[4];
1072
1080 int struct_version;
1081
1083 const char* trustStore;
1084
1088 const char* keyStore;
1089
1093 const char* privateKey;
1094
1096 const char* privateKeyPassword;
1097
1106 const char* enabledCipherSuites;
1107
1109 int enableServerCertAuth;
1110
1115 int sslVersion;
1116
1122 int verify;
1123
1129 const char* CApath;
1130
1135 int (*ssl_error_cb) (const char *str, size_t len, void *u);
1136
1141 void* ssl_error_context;
1142
1148 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);
1149
1154 void* ssl_psk_context;
1155
1161 int disableDefaultTrustStore;
1162
1170 const unsigned char *protos;
1171
1176 unsigned int protos_len;
1177 } MQTTAsync_SSLOptions;
1178
1179 #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 }
1180
1182 typedef struct
1183 {
1184 const char* name;
1185 const char* value;
1186 } MQTTAsync_nameValue;
1187
1198 typedef struct
1199 {
1201 char struct_id[4];
1212 int struct_version;
1223 int keepAliveInterval;
1245 int cleansession;
1249 int maxInflight;
1255 MQTTAsync_willOptions* will;
1261 const char* username;
1267 const char* password;
1271 int connectTimeout;
1279 int retryInterval;
1284 MQTTAsync_SSLOptions* ssl;
1290 MQTTAsync_onSuccess* onSuccess;
1296 MQTTAsync_onFailure* onFailure;
1302 void* context;
1306 int serverURIcount;
1318 char* const* serverURIs;
1325 int MQTTVersion;
1329 int automaticReconnect;
1333 int minRetryInterval;
1337 int maxRetryInterval;
1341 struct {
1342 int len;
1343 const void* data;
1344 } binarypwd;
1345 /*
1346 * MQTT V5 clean start flag. Only clears state at the beginning of the session.
1347 */
1348 int cleanstart;
1352 MQTTProperties *connectProperties;
1356 MQTTProperties *willProperties;
1362 MQTTAsync_onSuccess5* onSuccess5;
1368 MQTTAsync_onFailure5* onFailure5;
1372 const MQTTAsync_nameValue* httpHeaders;
1376 const char* httpProxy;
1380 const char* httpsProxy;
1381 } MQTTAsync_connectOptions;
1382
1384 #define MQTTAsync_connectOptions_initializer { {'M', 'Q', 'T', 'C'}, 8, 60, 1, 65535, NULL, NULL, NULL, 30, 0,\
1385 NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_DEFAULT, 0, 1, 60, {0, NULL}, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1386
1388 #define MQTTAsync_connectOptions_initializer5 { {'M', 'Q', 'T', 'C'}, 8, 60, 0, 65535, NULL, NULL, NULL, 30, 0,\
1389 NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_5, 0, 1, 60, {0, NULL}, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1390
1394 #define MQTTAsync_connectOptions_initializer_ws { {'M', 'Q', 'T', 'C'}, 8, 45, 1, 65535, NULL, NULL, NULL, 30, 0,\
1395 NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_DEFAULT, 0, 1, 60, {0, NULL}, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1396
1400 #define MQTTAsync_connectOptions_initializer5_ws { {'M', 'Q', 'T', 'C'}, 8, 45, 0, 65535, NULL, NULL, NULL, 30, 0,\
1401 NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_5, 0, 1, 60, {0, NULL}, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1402
1403
1424 LIBMQTT_API int MQTTAsync_connect(MQTTAsync handle, const MQTTAsync_connectOptions* options);
1425
1427 typedef struct
1428 {
1430 char struct_id[4];
1432 int struct_version;
1437 int timeout;
1443 MQTTAsync_onSuccess* onSuccess;
1449 MQTTAsync_onFailure* onFailure;
1455 void* context;
1459 MQTTProperties properties;
1463 enum MQTTReasonCodes reasonCode;
1469 MQTTAsync_onSuccess5* onSuccess5;
1475 MQTTAsync_onFailure5* onFailure5;
1476 } MQTTAsync_disconnectOptions;
1477
1478 #define MQTTAsync_disconnectOptions_initializer { {'M', 'Q', 'T', 'D'}, 0, 0, NULL, NULL, NULL,\
1479 MQTTProperties_initializer, MQTTREASONCODE_SUCCESS, NULL, NULL }
1480
1481 #define MQTTAsync_disconnectOptions_initializer5 { {'M', 'Q', 'T', 'D'}, 1, 0, NULL, NULL, NULL,\
1482 MQTTProperties_initializer, MQTTREASONCODE_SUCCESS, NULL, NULL }
1483
1502 LIBMQTT_API int MQTTAsync_disconnect(MQTTAsync handle, const MQTTAsync_disconnectOptions* options);
1503
1504
1512 LIBMQTT_API int MQTTAsync_isConnected(MQTTAsync handle);
1513
1514
1529 LIBMQTT_API int MQTTAsync_subscribe(MQTTAsync handle, const char* topic, int qos, MQTTAsync_responseOptions* response);
1530
1531
1549 LIBMQTT_API int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char* const* topic, const int* qos, MQTTAsync_responseOptions* response);
1550
1563 LIBMQTT_API int MQTTAsync_unsubscribe(MQTTAsync handle, const char* topic, MQTTAsync_responseOptions* response);
1564
1577 LIBMQTT_API int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char* const* topic, MQTTAsync_responseOptions* response);
1578
1579
1599 LIBMQTT_API int MQTTAsync_send(MQTTAsync handle, const char* destinationName, int payloadlen, const void* payload, int qos,
1600 int retained, MQTTAsync_responseOptions* response);
1601
1618 LIBMQTT_API int MQTTAsync_sendMessage(MQTTAsync handle, const char* destinationName, const MQTTAsync_message* msg, MQTTAsync_responseOptions* response);
1619
1620
1639 LIBMQTT_API int MQTTAsync_getPendingTokens(MQTTAsync handle, MQTTAsync_token **tokens);
1640
1649 #define MQTTASYNC_TRUE 1
1650 LIBMQTT_API int MQTTAsync_isComplete(MQTTAsync handle, MQTTAsync_token token);
1651
1652
1665 LIBMQTT_API int MQTTAsync_waitForCompletion(MQTTAsync handle, MQTTAsync_token token, unsigned long timeout);
1666
1667
1678 LIBMQTT_API void MQTTAsync_freeMessage(MQTTAsync_message** msg);
1679
1688 LIBMQTT_API void MQTTAsync_free(void* ptr);
1689
1697 LIBMQTT_API void* MQTTAsync_malloc(size_t size);
1698
1706 LIBMQTT_API void MQTTAsync_destroy(MQTTAsync* handle);
1707
1708
1709
1710 enum MQTTASYNC_TRACE_LEVELS
1711 {
1712 MQTTASYNC_TRACE_MAXIMUM = 1,
1713 MQTTASYNC_TRACE_MEDIUM,
1714 MQTTASYNC_TRACE_MINIMUM,
1715 MQTTASYNC_TRACE_PROTOCOL,
1716 MQTTASYNC_TRACE_ERROR,
1717 MQTTASYNC_TRACE_SEVERE,
1718 MQTTASYNC_TRACE_FATAL,
1719 };
1720
1721
1727 LIBMQTT_API void MQTTAsync_setTraceLevel(enum MQTTASYNC_TRACE_LEVELS level);
1728
1729
1739 typedef void MQTTAsync_traceCallback(enum MQTTASYNC_TRACE_LEVELS level, char* message);
1740
1747 LIBMQTT_API void MQTTAsync_setTraceCallback(MQTTAsync_traceCallback* callback);
1748
1755 LIBMQTT_API MQTTAsync_nameValue* MQTTAsync_getVersionInfo(void);
1756
1763 LIBMQTT_API const char* MQTTAsync_strerror(int code);
1764
1765
2379 #if defined(__cplusplus)
2380 }
2381 #endif
2382
2383 #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:253
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:430
MQTTAsync_connectionLost
void MQTTAsync_connectionLost(void *context, char *cause)
Definition: MQTTAsync.h:412
MQTTAsync_messageArrived
int MQTTAsync_messageArrived(void *context, char *topicName, int topicLen, MQTTAsync_message *message)
Definition: MQTTAsync.h:369
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:444
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_TRACE_LEVELS
MQTTASYNC_TRACE_LEVELS
Definition: MQTTAsync.h:1711
MQTTASYNC_TRACE_FATAL
@ MQTTASYNC_TRACE_FATAL
Definition: MQTTAsync.h:1718
MQTTASYNC_TRACE_MEDIUM
@ MQTTASYNC_TRACE_MEDIUM
Definition: MQTTAsync.h:1713
MQTTASYNC_TRACE_SEVERE
@ MQTTASYNC_TRACE_SEVERE
Definition: MQTTAsync.h:1717
MQTTASYNC_TRACE_PROTOCOL
@ MQTTASYNC_TRACE_PROTOCOL
Definition: MQTTAsync.h:1715
MQTTASYNC_TRACE_MINIMUM
@ MQTTASYNC_TRACE_MINIMUM
Definition: MQTTAsync.h:1714
MQTTASYNC_TRACE_ERROR
@ MQTTASYNC_TRACE_ERROR
Definition: MQTTAsync.h:1716
MQTTASYNC_TRACE_MAXIMUM
@ MQTTASYNC_TRACE_MAXIMUM
Definition: MQTTAsync.h:1712
MQTTAsync_updateConnectOptions
int MQTTAsync_updateConnectOptions(void *context, MQTTAsync_connectData *data)
Definition: MQTTAsync.h:497
MQTTAsync_onFailure
void MQTTAsync_onFailure(void *context, MQTTAsync_failureData *response)
Definition: MQTTAsync.h:686
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:1739
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:655
MQTTAsync_token
int MQTTAsync_token
Definition: MQTTAsync.h:263
MQTTAsync_getVersionInfo
MQTTAsync_nameValue * MQTTAsync_getVersionInfo(void)
MQTTAsync_strerror
const char * MQTTAsync_strerror(int code)
MQTTAsync_onSuccess5
void MQTTAsync_onSuccess5(void *context, MQTTAsync_successData5 *response)
Definition: MQTTAsync.h:671
MQTTAsync_onFailure5
void MQTTAsync_onFailure5(void *context, MQTTAsync_failureData5 *response)
Definition: MQTTAsync.h:701
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:392
MQTTAsync_isComplete
int MQTTAsync_isComplete(MQTTAsync handle, MQTTAsync_token token)
MQTTAsync_setAfterPersistenceRead
int MQTTAsync_setAfterPersistenceRead(MQTTAsync handle, void *context, MQTTPersistence_afterRead *co)
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_responseOptions
struct MQTTAsync_responseOptions MQTTAsync_responseOptions
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)
MQTTAsync_malloc
void * MQTTAsync_malloc(size_t size)
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:1069
MQTTAsync_SSLOptions::trustStore
const char * trustStore
Definition: MQTTAsync.h:1083
MQTTAsync_SSLOptions::struct_version
int struct_version
Definition: MQTTAsync.h:1080
MQTTAsync_SSLOptions::disableDefaultTrustStore
int disableDefaultTrustStore
Definition: MQTTAsync.h:1161
MQTTAsync_SSLOptions::ssl_error_context
void * ssl_error_context
Definition: MQTTAsync.h:1141
MQTTAsync_SSLOptions::protos_len
unsigned int protos_len
Definition: MQTTAsync.h:1176
MQTTAsync_SSLOptions::CApath
const char * CApath
Definition: MQTTAsync.h:1129
MQTTAsync_SSLOptions::keyStore
const char * keyStore
Definition: MQTTAsync.h:1088
MQTTAsync_SSLOptions::sslVersion
int sslVersion
Definition: MQTTAsync.h:1115
MQTTAsync_SSLOptions::protos
const unsigned char * protos
Definition: MQTTAsync.h:1170
MQTTAsync_SSLOptions::enableServerCertAuth
int enableServerCertAuth
Definition: MQTTAsync.h:1109
MQTTAsync_SSLOptions::privateKey
const char * privateKey
Definition: MQTTAsync.h:1093
MQTTAsync_SSLOptions::verify
int verify
Definition: MQTTAsync.h:1122
MQTTAsync_SSLOptions::enabledCipherSuites
const char * enabledCipherSuites
Definition: MQTTAsync.h:1106
MQTTAsync_SSLOptions::ssl_psk_context
void * ssl_psk_context
Definition: MQTTAsync.h:1154
MQTTAsync_SSLOptions::privateKeyPassword
const char * privateKeyPassword
Definition: MQTTAsync.h:1096
MQTTAsync_connectData
Definition: MQTTAsync.h:466
MQTTAsync_connectData::struct_version
int struct_version
Definition: MQTTAsync.h:470
MQTTAsync_connectData::data
const void * data
Definition: MQTTAsync.h:485
MQTTAsync_connectData::username
const char * username
Definition: MQTTAsync.h:477
MQTTAsync_connectData::len
int len
Definition: MQTTAsync.h:484
MQTTAsync_connectOptions
Definition: MQTTAsync.h:1199
MQTTAsync_connectOptions::maxRetryInterval
int maxRetryInterval
Definition: MQTTAsync.h:1337
MQTTAsync_connectOptions::cleansession
int cleansession
Definition: MQTTAsync.h:1245
MQTTAsync_connectOptions::struct_version
int struct_version
Definition: MQTTAsync.h:1212
MQTTAsync_connectOptions::onFailure
MQTTAsync_onFailure * onFailure
Definition: MQTTAsync.h:1296
MQTTAsync_connectOptions::data
const void * data
Definition: MQTTAsync.h:1343
MQTTAsync_connectOptions::MQTTVersion
int MQTTVersion
Definition: MQTTAsync.h:1325
MQTTAsync_connectOptions::minRetryInterval
int minRetryInterval
Definition: MQTTAsync.h:1333
MQTTAsync_connectOptions::onSuccess5
MQTTAsync_onSuccess5 * onSuccess5
Definition: MQTTAsync.h:1362
MQTTAsync_connectOptions::httpsProxy
const char * httpsProxy
Definition: MQTTAsync.h:1380
MQTTAsync_connectOptions::connectTimeout
int connectTimeout
Definition: MQTTAsync.h:1271
MQTTAsync_connectOptions::onFailure5
MQTTAsync_onFailure5 * onFailure5
Definition: MQTTAsync.h:1368
MQTTAsync_connectOptions::maxInflight
int maxInflight
Definition: MQTTAsync.h:1249
MQTTAsync_connectOptions::automaticReconnect
int automaticReconnect
Definition: MQTTAsync.h:1329
MQTTAsync_connectOptions::will
MQTTAsync_willOptions * will
Definition: MQTTAsync.h:1255
MQTTAsync_connectOptions::ssl
MQTTAsync_SSLOptions * ssl
Definition: MQTTAsync.h:1284
MQTTAsync_connectOptions::connectProperties
MQTTProperties * connectProperties
Definition: MQTTAsync.h:1352
MQTTAsync_connectOptions::password
const char * password
Definition: MQTTAsync.h:1267
MQTTAsync_connectOptions::serverURIcount
int serverURIcount
Definition: MQTTAsync.h:1306
MQTTAsync_connectOptions::serverURIs
char *const * serverURIs
Definition: MQTTAsync.h:1318
MQTTAsync_connectOptions::username
const char * username
Definition: MQTTAsync.h:1261
MQTTAsync_connectOptions::onSuccess
MQTTAsync_onSuccess * onSuccess
Definition: MQTTAsync.h:1290
MQTTAsync_connectOptions::willProperties
MQTTProperties * willProperties
Definition: MQTTAsync.h:1356
MQTTAsync_connectOptions::httpHeaders
const MQTTAsync_nameValue * httpHeaders
Definition: MQTTAsync.h:1372
MQTTAsync_connectOptions::retryInterval
int retryInterval
Definition: MQTTAsync.h:1279
MQTTAsync_connectOptions::keepAliveInterval
int keepAliveInterval
Definition: MQTTAsync.h:1223
MQTTAsync_connectOptions::cleanstart
int cleanstart
Definition: MQTTAsync.h:1348
MQTTAsync_connectOptions::httpProxy
const char * httpProxy
Definition: MQTTAsync.h:1376
MQTTAsync_connectOptions::context
void * context
Definition: MQTTAsync.h:1302
MQTTAsync_connectOptions::len
int len
Definition: MQTTAsync.h:1342
MQTTAsync_createOptions
Definition: MQTTAsync.h:961
MQTTAsync_createOptions::struct_version
int struct_version
Definition: MQTTAsync.h:969
MQTTAsync_createOptions::sendWhileDisconnected
int sendWhileDisconnected
Definition: MQTTAsync.h:971
MQTTAsync_createOptions::persistQoS0
int persistQoS0
Definition: MQTTAsync.h:997
MQTTAsync_createOptions::MQTTVersion
int MQTTVersion
Definition: MQTTAsync.h:981
MQTTAsync_createOptions::restoreMessages
int restoreMessages
Definition: MQTTAsync.h:993
MQTTAsync_createOptions::maxBufferedMessages
int maxBufferedMessages
Definition: MQTTAsync.h:975
MQTTAsync_createOptions::deleteOldestMessages
int deleteOldestMessages
Definition: MQTTAsync.h:989
MQTTAsync_createOptions::allowDisconnectedSendAtAnyTime
int allowDisconnectedSendAtAnyTime
Definition: MQTTAsync.h:985
MQTTAsync_disconnectOptions
Definition: MQTTAsync.h:1428
MQTTAsync_disconnectOptions::struct_version
int struct_version
Definition: MQTTAsync.h:1432
MQTTAsync_disconnectOptions::onFailure
MQTTAsync_onFailure * onFailure
Definition: MQTTAsync.h:1449
MQTTAsync_disconnectOptions::properties
MQTTProperties properties
Definition: MQTTAsync.h:1459
MQTTAsync_disconnectOptions::onSuccess5
MQTTAsync_onSuccess5 * onSuccess5
Definition: MQTTAsync.h:1469
MQTTAsync_disconnectOptions::timeout
int timeout
Definition: MQTTAsync.h:1437
MQTTAsync_disconnectOptions::onFailure5
MQTTAsync_onFailure5 * onFailure5
Definition: MQTTAsync.h:1475
MQTTAsync_disconnectOptions::onSuccess
MQTTAsync_onSuccess * onSuccess
Definition: MQTTAsync.h:1443
MQTTAsync_disconnectOptions::context
void * context
Definition: MQTTAsync.h:1455
MQTTAsync_failureData5
Definition: MQTTAsync.h:548
MQTTAsync_failureData5::struct_version
int struct_version
Definition: MQTTAsync.h:552
MQTTAsync_failureData5::properties
MQTTProperties properties
Definition: MQTTAsync.h:558
MQTTAsync_failureData5::message
const char * message
Definition: MQTTAsync.h:562
MQTTAsync_failureData5::packet_type
int packet_type
Definition: MQTTAsync.h:564
MQTTAsync_failureData5::code
int code
Definition: MQTTAsync.h:560
MQTTAsync_failureData
Definition: MQTTAsync.h:536
MQTTAsync_failureData::message
const char * message
Definition: MQTTAsync.h:542
MQTTAsync_failureData::code
int code
Definition: MQTTAsync.h:540
MQTTAsync_failureData::token
MQTTAsync_token token
Definition: MQTTAsync.h:538
MQTTAsync_init_options
Definition: MQTTAsync.h:232
MQTTAsync_init_options::struct_version
int struct_version
Definition: MQTTAsync.h:236
MQTTAsync_init_options::do_openssl_init
int do_openssl_init
Definition: MQTTAsync.h:238
MQTTAsync_message
Definition: MQTTAsync.h:272
MQTTAsync_message::struct_version
int struct_version
Definition: MQTTAsync.h:277
MQTTAsync_message::properties
MQTTProperties properties
Definition: MQTTAsync.h:331
MQTTAsync_message::qos
int qos
Definition: MQTTAsync.h:295
MQTTAsync_message::msgid
int msgid
Definition: MQTTAsync.h:327
MQTTAsync_message::retained
int retained
Definition: MQTTAsync.h:314
MQTTAsync_message::payload
void * payload
Definition: MQTTAsync.h:281
MQTTAsync_message::payloadlen
int payloadlen
Definition: MQTTAsync.h:279
MQTTAsync_message::dup
int dup
Definition: MQTTAsync.h:321
MQTTAsync_nameValue
Definition: MQTTAsync.h:1183
MQTTAsync_nameValue::value
const char * value
Definition: MQTTAsync.h:1185
MQTTAsync_nameValue::name
const char * name
Definition: MQTTAsync.h:1184
MQTTAsync_responseOptions
Definition: MQTTAsync.h:709
MQTTAsync_responseOptions::struct_version
int struct_version
Definition: MQTTAsync.h:714
MQTTAsync_responseOptions::onFailure
MQTTAsync_onFailure * onFailure
Definition: MQTTAsync.h:726
MQTTAsync_responseOptions::properties
MQTTProperties properties
Definition: MQTTAsync.h:755
MQTTAsync_responseOptions::subscribeOptions
MQTTSubscribe_options subscribeOptions
Definition: MQTTAsync.h:759
MQTTAsync_responseOptions::subscribeOptionsCount
int subscribeOptionsCount
Definition: MQTTAsync.h:764
MQTTAsync_responseOptions::onSuccess5
MQTTAsync_onSuccess5 * onSuccess5
Definition: MQTTAsync.h:745
MQTTAsync_responseOptions::onFailure5
MQTTAsync_onFailure5 * onFailure5
Definition: MQTTAsync.h:751
MQTTAsync_responseOptions::subscribeOptionsList
MQTTSubscribe_options * subscribeOptionsList
Definition: MQTTAsync.h:768
MQTTAsync_responseOptions::struct_id
char struct_id[4]
Definition: MQTTAsync.h:711
MQTTAsync_responseOptions::onSuccess
MQTTAsync_onSuccess * onSuccess
Definition: MQTTAsync.h:720
MQTTAsync_responseOptions::context
void * context
Definition: MQTTAsync.h:732
MQTTAsync_responseOptions::token
MQTTAsync_token token
Definition: MQTTAsync.h:739
MQTTAsync_successData5
Definition: MQTTAsync.h:602
MQTTAsync_successData5::struct_version
int struct_version
Definition: MQTTAsync.h:604
MQTTAsync_successData5::MQTTVersion
int MQTTVersion
Definition: MQTTAsync.h:628
MQTTAsync_successData5::properties
MQTTProperties properties
Definition: MQTTAsync.h:608
MQTTAsync_successData5::reasonCodes
enum MQTTReasonCodes * reasonCodes
Definition: MQTTAsync.h:616
MQTTAsync_successData5::sessionPresent
int sessionPresent
Definition: MQTTAsync.h:629
MQTTAsync_successData5::message
MQTTAsync_message message
Definition: MQTTAsync.h:621
MQTTAsync_successData5::serverURI
char * serverURI
Definition: MQTTAsync.h:627
MQTTAsync_successData5::reasonCodeCount
int reasonCodeCount
Definition: MQTTAsync.h:615
MQTTAsync_successData5::destinationName
char * destinationName
Definition: MQTTAsync.h:622
MQTTAsync_successData
Definition: MQTTAsync.h:571
MQTTAsync_successData::MQTTVersion
int MQTTVersion
Definition: MQTTAsync.h:593
MQTTAsync_successData::qos
int qos
Definition: MQTTAsync.h:579
MQTTAsync_successData::sessionPresent
int sessionPresent
Definition: MQTTAsync.h:594
MQTTAsync_successData::message
MQTTAsync_message message
Definition: MQTTAsync.h:586
MQTTAsync_successData::qosList
int * qosList
Definition: MQTTAsync.h:582
MQTTAsync_successData::serverURI
char * serverURI
Definition: MQTTAsync.h:592
MQTTAsync_successData::destinationName
char * destinationName
Definition: MQTTAsync.h:587
MQTTAsync_successData::token
MQTTAsync_token token
Definition: MQTTAsync.h:573
MQTTAsync_willOptions
Definition: MQTTAsync.h:1021
MQTTAsync_willOptions::struct_version
int struct_version
Definition: MQTTAsync.h:1027
MQTTAsync_willOptions::data
const void * data
Definition: MQTTAsync.h:1045
MQTTAsync_willOptions::topicName
const char * topicName
Definition: MQTTAsync.h:1029
MQTTAsync_willOptions::message
const char * message
Definition: MQTTAsync.h:1031
MQTTAsync_willOptions::qos
int qos
Definition: MQTTAsync.h:1040
MQTTAsync_willOptions::retained
int retained
Definition: MQTTAsync.h:1035
MQTTAsync_willOptions::len
int len
Definition: MQTTAsync.h:1044
MQTTProperties
Definition: MQTTProperties.h:113
MQTTSubscribe_options
Definition: MQTTSubscribeOpts.h:22