91#if !defined(MQTTASYNC_H)
94#if defined(__cplusplus)
103#include "MQTTExportDeclarations.h"
108#if !defined(NO_PERSISTENCE)
111#define MQTTCLIENT_PERSISTENCE_NONE 1
118#define MQTTASYNC_SUCCESS 0
123#define MQTTASYNC_FAILURE -1
127#define MQTTASYNC_PERSISTENCE_ERROR -2
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
205#define MQTTASYNC_COMMAND_IGNORED -18
209 #define MQTTASYNC_MAX_BUFFERED -19
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
246#define MQTTAsync_init_options_initializer { {'M', 'Q', 'T', 'G'}, 0, 0 }
339#define MQTTAsync_message_initializer { {'M', 'Q', 'T', 'M'}, 1, 0, NULL, 0, 0, 0, 0, MQTTProperties_initializer }
493#define MQTTAsync_connectData_initializer {{'M', 'Q', 'C', 'D'}, 0, NULL, {0, NULL}}
514#if !defined(NO_PERSISTENCE)
572#define MQTTAsync_failureData5_initializer {{'M', 'Q', 'F', 'D'}, 0, 0, MQTTREASONCODE_SUCCESS, MQTTProperties_initializer, 0, NULL, 0}
645#define MQTTAsync_successData5_initializer {{'M', 'Q', 'S', 'D'}, 0, 0, MQTTREASONCODE_SUCCESS, MQTTProperties_initializer, {.sub={0,0}}}
776#define MQTTAsync_responseOptions_initializer { {'M', 'Q', 'T', 'R'}, 1, NULL, NULL, 0, 0, NULL, NULL, MQTTProperties_initializer, MQTTSubscribe_options_initializer, 0, NULL}
780#define MQTTAsync_callOptions_initializer MQTTAsync_responseOptions_initializer
961 int persistence_type,
void* persistence_context);
1004#define MQTTAsync_createOptions_initializer { {'M', 'Q', 'C', 'O'}, 2, 0, 100, MQTTVERSION_DEFAULT, 0, 0, 1, 1}
1006#define MQTTAsync_createOptions_initializer5 { {'M', 'Q', 'C', 'O'}, 2, 0, 100, MQTTVERSION_5, 0, 0, 1, 1}
1053#define MQTTAsync_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 1, NULL, NULL, 0, 0, { 0, NULL } }
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
1139 int (*ssl_error_cb) (
const char *str,
size_t len,
void *u);
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);
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 }
1390#define MQTTAsync_connectOptions_initializer { {'M', 'Q', 'T', 'C'}, 8, 60, 1, 65535, NULL, NULL, NULL, 30, 0,\
1391NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_DEFAULT, 0, 1, 60, {0, NULL}, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1394#define MQTTAsync_connectOptions_initializer5 { {'M', 'Q', 'T', 'C'}, 8, 60, 0, 65535, NULL, NULL, NULL, 30, 0,\
1395NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_5, 0, 1, 60, {0, NULL}, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1400#define MQTTAsync_connectOptions_initializer_ws { {'M', 'Q', 'T', 'C'}, 8, 45, 1, 65535, NULL, NULL, NULL, 30, 0,\
1401NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_DEFAULT, 0, 1, 60, {0, NULL}, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1406#define MQTTAsync_connectOptions_initializer5_ws { {'M', 'Q', 'T', 'C'}, 8, 45, 0, 65535, NULL, NULL, NULL, 30, 0,\
1407NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_5, 0, 1, 60, {0, NULL}, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
1484#define MQTTAsync_disconnectOptions_initializer { {'M', 'Q', 'T', 'D'}, 0, 0, NULL, NULL, NULL,\
1485 MQTTProperties_initializer, MQTTREASONCODE_SUCCESS, NULL, NULL }
1487#define MQTTAsync_disconnectOptions_initializer5 { {'M', 'Q', 'T', 'D'}, 1, 0, NULL, NULL, NULL,\
1488 MQTTProperties_initializer, MQTTREASONCODE_SUCCESS, NULL, NULL }
1655#define MQTTASYNC_TRUE 1
2400#if defined(__cplusplus)
int MQTTAsync_connect(MQTTAsync handle, const MQTTAsync_connectOptions *options)
int MQTTAsync_unsubscribe(MQTTAsync handle, const char *topic, MQTTAsync_responseOptions *response)
void MQTTAsync_setTraceCallback(MQTTAsync_traceCallback *callback)
void * MQTTAsync
Definition MQTTAsync.h:258
int MQTTAsync_setBeforePersistenceWrite(MQTTAsync handle, void *context, MQTTPersistence_beforeWrite *co)
void MQTTAsync_global_init(MQTTAsync_init_options *inits)
int MQTTAsync_setConnected(MQTTAsync handle, void *context, MQTTAsync_connected *co)
void MQTTAsync_free(void *ptr)
void MQTTAsync_connected(void *context, char *cause)
Definition MQTTAsync.h:435
void MQTTAsync_connectionLost(void *context, char *cause)
Definition MQTTAsync.h:417
int MQTTAsync_messageArrived(void *context, char *topicName, int topicLen, MQTTAsync_message *message)
Definition MQTTAsync.h:374
int MQTTAsync_setMessageArrivedCallback(MQTTAsync handle, void *context, MQTTAsync_messageArrived *ma)
int MQTTAsync_isConnected(MQTTAsync handle)
int MQTTAsync_waitForCompletion(MQTTAsync handle, MQTTAsync_token token, unsigned long timeout)
void MQTTAsync_disconnected(void *context, MQTTProperties *properties, enum MQTTReasonCodes reasonCode)
Definition MQTTAsync.h:448
int MQTTAsync_create(MQTTAsync *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context)
int MQTTAsync_sendMessage(MQTTAsync handle, const char *destinationName, const MQTTAsync_message *msg, MQTTAsync_responseOptions *response)
MQTTAsync_nameValue * MQTTAsync_getVersionInfo(void)
MQTTASYNC_TRACE_LEVELS
Definition MQTTAsync.h:1717
@ MQTTASYNC_TRACE_FATAL
Definition MQTTAsync.h:1724
@ MQTTASYNC_TRACE_MEDIUM
Definition MQTTAsync.h:1719
@ MQTTASYNC_TRACE_SEVERE
Definition MQTTAsync.h:1723
@ MQTTASYNC_TRACE_PROTOCOL
Definition MQTTAsync.h:1721
@ MQTTASYNC_TRACE_MINIMUM
Definition MQTTAsync.h:1720
@ MQTTASYNC_TRACE_ERROR
Definition MQTTAsync.h:1722
@ MQTTASYNC_TRACE_MAXIMUM
Definition MQTTAsync.h:1718
int MQTTAsync_updateConnectOptions(void *context, MQTTAsync_connectData *data)
Definition MQTTAsync.h:501
void MQTTAsync_onFailure(void *context, MQTTAsync_failureData *response)
Definition MQTTAsync.h:691
int MQTTAsync_send(MQTTAsync handle, const char *destinationName, int payloadlen, const void *payload, int qos, int retained, MQTTAsync_responseOptions *response)
void MQTTAsync_traceCallback(enum MQTTASYNC_TRACE_LEVELS level, char *message)
Definition MQTTAsync.h:1745
int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char *const *topic, MQTTAsync_responseOptions *response)
int MQTTAsync_createWithOptions(MQTTAsync *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context, MQTTAsync_createOptions *options)
void MQTTAsync_onSuccess(void *context, MQTTAsync_successData *response)
Definition MQTTAsync.h:660
int MQTTAsync_token
Definition MQTTAsync.h:268
const char * MQTTAsync_strerror(int code)
void MQTTAsync_onSuccess5(void *context, MQTTAsync_successData5 *response)
Definition MQTTAsync.h:676
void * MQTTAsync_malloc(size_t size)
void MQTTAsync_onFailure5(void *context, MQTTAsync_failureData5 *response)
Definition MQTTAsync.h:706
int MQTTAsync_setDeliveryCompleteCallback(MQTTAsync handle, void *context, MQTTAsync_deliveryComplete *dc)
void MQTTAsync_freeMessage(MQTTAsync_message **msg)
int MQTTAsync_setUpdateConnectOptions(MQTTAsync handle, void *context, MQTTAsync_updateConnectOptions *co)
void MQTTAsync_deliveryComplete(void *context, MQTTAsync_token token)
Definition MQTTAsync.h:397
int MQTTAsync_isComplete(MQTTAsync handle, MQTTAsync_token token)
int MQTTAsync_setAfterPersistenceRead(MQTTAsync handle, void *context, MQTTPersistence_afterRead *co)
int MQTTAsync_getPendingTokens(MQTTAsync handle, MQTTAsync_token **tokens)
int MQTTAsync_reconnect(MQTTAsync handle)
int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char *const *topic, const int *qos, MQTTAsync_responseOptions *response)
void MQTTAsync_setTraceLevel(enum MQTTASYNC_TRACE_LEVELS level)
void MQTTAsync_destroy(MQTTAsync *handle)
int MQTTAsync_setDisconnected(MQTTAsync handle, void *context, MQTTAsync_disconnected *co)
int MQTTAsync_disconnect(MQTTAsync handle, const MQTTAsync_disconnectOptions *options)
int MQTTAsync_subscribe(MQTTAsync handle, const char *topic, int qos, MQTTAsync_responseOptions *response)
struct MQTTAsync_responseOptions MQTTAsync_responseOptions
int MQTTAsync_setCallbacks(MQTTAsync handle, void *context, MQTTAsync_connectionLost *cl, MQTTAsync_messageArrived *ma, MQTTAsync_deliveryComplete *dc)
int MQTTAsync_setConnectionLostCallback(MQTTAsync handle, void *context, MQTTAsync_connectionLost *cl)
This structure represents a persistent data store, used to store outbound and inbound messages,...
int MQTTPersistence_beforeWrite(void *context, int bufcount, char *buffers[], int buflens[])
Definition MQTTClientPersistence.h:264
int MQTTPersistence_afterRead(void *context, char **buffer, int *buflen)
Definition MQTTClientPersistence.h:275
MQTTReasonCodes
Definition MQTTReasonCodes.h:23
Definition MQTTAsync.h:1073
const char * trustStore
Definition MQTTAsync.h:1087
int struct_version
Definition MQTTAsync.h:1084
int disableDefaultTrustStore
Definition MQTTAsync.h:1165
void * ssl_error_context
Definition MQTTAsync.h:1145
unsigned int protos_len
Definition MQTTAsync.h:1180
const char * CApath
Definition MQTTAsync.h:1133
const char * keyStore
Definition MQTTAsync.h:1092
int sslVersion
Definition MQTTAsync.h:1119
const unsigned char * protos
Definition MQTTAsync.h:1174
int enableServerCertAuth
Definition MQTTAsync.h:1113
const char * privateKey
Definition MQTTAsync.h:1097
int verify
Definition MQTTAsync.h:1126
const char * enabledCipherSuites
Definition MQTTAsync.h:1110
void * ssl_psk_context
Definition MQTTAsync.h:1158
const char * privateKeyPassword
Definition MQTTAsync.h:1100
Definition MQTTAsync.h:470
int struct_version
Definition MQTTAsync.h:474
const void * data
Definition MQTTAsync.h:489
const char * username
Definition MQTTAsync.h:481
int len
Definition MQTTAsync.h:488
Definition MQTTAsync.h:1203
int maxRetryInterval
Definition MQTTAsync.h:1341
int cleansession
Definition MQTTAsync.h:1249
int struct_version
Definition MQTTAsync.h:1216
MQTTAsync_onFailure * onFailure
Definition MQTTAsync.h:1300
const void * data
Definition MQTTAsync.h:1347
int MQTTVersion
Definition MQTTAsync.h:1329
int minRetryInterval
Definition MQTTAsync.h:1337
MQTTAsync_onSuccess5 * onSuccess5
Definition MQTTAsync.h:1366
const char * httpsProxy
Definition MQTTAsync.h:1386
int connectTimeout
Definition MQTTAsync.h:1275
MQTTAsync_onFailure5 * onFailure5
Definition MQTTAsync.h:1372
int maxInflight
Definition MQTTAsync.h:1253
int automaticReconnect
Definition MQTTAsync.h:1333
MQTTAsync_willOptions * will
Definition MQTTAsync.h:1259
MQTTAsync_SSLOptions * ssl
Definition MQTTAsync.h:1288
MQTTProperties * connectProperties
Definition MQTTAsync.h:1356
const char * password
Definition MQTTAsync.h:1271
int serverURIcount
Definition MQTTAsync.h:1310
char *const * serverURIs
Definition MQTTAsync.h:1322
const char * username
Definition MQTTAsync.h:1265
MQTTAsync_onSuccess * onSuccess
Definition MQTTAsync.h:1294
MQTTProperties * willProperties
Definition MQTTAsync.h:1360
const MQTTAsync_nameValue * httpHeaders
Definition MQTTAsync.h:1376
int retryInterval
Definition MQTTAsync.h:1283
int keepAliveInterval
Definition MQTTAsync.h:1227
int cleanstart
Definition MQTTAsync.h:1352
const char * httpProxy
Definition MQTTAsync.h:1382
void * context
Definition MQTTAsync.h:1306
int len
Definition MQTTAsync.h:1346
Definition MQTTAsync.h:965
int struct_version
Definition MQTTAsync.h:973
int sendWhileDisconnected
Definition MQTTAsync.h:975
int persistQoS0
Definition MQTTAsync.h:1001
int MQTTVersion
Definition MQTTAsync.h:985
int restoreMessages
Definition MQTTAsync.h:997
int maxBufferedMessages
Definition MQTTAsync.h:979
int deleteOldestMessages
Definition MQTTAsync.h:993
int allowDisconnectedSendAtAnyTime
Definition MQTTAsync.h:989
Definition MQTTAsync.h:1434
int struct_version
Definition MQTTAsync.h:1438
MQTTAsync_onFailure * onFailure
Definition MQTTAsync.h:1455
MQTTProperties properties
Definition MQTTAsync.h:1465
MQTTAsync_onSuccess5 * onSuccess5
Definition MQTTAsync.h:1475
int timeout
Definition MQTTAsync.h:1443
MQTTAsync_onFailure5 * onFailure5
Definition MQTTAsync.h:1481
enum MQTTReasonCodes reasonCode
Definition MQTTAsync.h:1469
MQTTAsync_onSuccess * onSuccess
Definition MQTTAsync.h:1449
void * context
Definition MQTTAsync.h:1461
Definition MQTTAsync.h:553
int struct_version
Definition MQTTAsync.h:557
MQTTProperties properties
Definition MQTTAsync.h:563
const char * message
Definition MQTTAsync.h:567
int packet_type
Definition MQTTAsync.h:569
int code
Definition MQTTAsync.h:565
enum MQTTReasonCodes reasonCode
Definition MQTTAsync.h:561
MQTTAsync_token token
Definition MQTTAsync.h:559
Definition MQTTAsync.h:541
const char * message
Definition MQTTAsync.h:547
int code
Definition MQTTAsync.h:545
MQTTAsync_token token
Definition MQTTAsync.h:543
Definition MQTTAsync.h:237
int struct_version
Definition MQTTAsync.h:241
int do_openssl_init
Definition MQTTAsync.h:243
Definition MQTTAsync.h:277
int struct_version
Definition MQTTAsync.h:282
MQTTProperties properties
Definition MQTTAsync.h:336
int qos
Definition MQTTAsync.h:300
int msgid
Definition MQTTAsync.h:332
int retained
Definition MQTTAsync.h:319
void * payload
Definition MQTTAsync.h:286
int payloadlen
Definition MQTTAsync.h:284
int dup
Definition MQTTAsync.h:326
Definition MQTTAsync.h:1187
const char * value
Definition MQTTAsync.h:1189
const char * name
Definition MQTTAsync.h:1188
Definition MQTTAsync.h:714
int struct_version
Definition MQTTAsync.h:719
MQTTAsync_onFailure * onFailure
Definition MQTTAsync.h:731
MQTTProperties properties
Definition MQTTAsync.h:760
MQTTSubscribe_options subscribeOptions
Definition MQTTAsync.h:764
int subscribeOptionsCount
Definition MQTTAsync.h:769
MQTTAsync_onSuccess5 * onSuccess5
Definition MQTTAsync.h:750
MQTTAsync_onFailure5 * onFailure5
Definition MQTTAsync.h:756
MQTTSubscribe_options * subscribeOptionsList
Definition MQTTAsync.h:773
char struct_id[4]
Definition MQTTAsync.h:716
MQTTAsync_onSuccess * onSuccess
Definition MQTTAsync.h:725
void * context
Definition MQTTAsync.h:737
MQTTAsync_token token
Definition MQTTAsync.h:744
Definition MQTTAsync.h:607
int struct_version
Definition MQTTAsync.h:609
int MQTTVersion
Definition MQTTAsync.h:633
MQTTProperties properties
Definition MQTTAsync.h:613
enum MQTTReasonCodes * reasonCodes
Definition MQTTAsync.h:621
int sessionPresent
Definition MQTTAsync.h:634
enum MQTTReasonCodes reasonCode
Definition MQTTAsync.h:612
MQTTAsync_message message
Definition MQTTAsync.h:626
char * serverURI
Definition MQTTAsync.h:632
int reasonCodeCount
Definition MQTTAsync.h:620
char * destinationName
Definition MQTTAsync.h:627
MQTTAsync_token token
Definition MQTTAsync.h:611
Definition MQTTAsync.h:576
int MQTTVersion
Definition MQTTAsync.h:598
int qos
Definition MQTTAsync.h:584
int sessionPresent
Definition MQTTAsync.h:599
MQTTAsync_message message
Definition MQTTAsync.h:591
int * qosList
Definition MQTTAsync.h:587
char * serverURI
Definition MQTTAsync.h:597
char * destinationName
Definition MQTTAsync.h:592
MQTTAsync_token token
Definition MQTTAsync.h:578
Definition MQTTAsync.h:1025
int struct_version
Definition MQTTAsync.h:1031
const void * data
Definition MQTTAsync.h:1049
const char * topicName
Definition MQTTAsync.h:1033
const char * message
Definition MQTTAsync.h:1035
int qos
Definition MQTTAsync.h:1044
int retained
Definition MQTTAsync.h:1039
int len
Definition MQTTAsync.h:1048
Definition MQTTProperties.h:116
Definition MQTTSubscribeOpts.h:22