88 #if !defined(MQTTASYNC_H)
91 #if defined(__cplusplus)
100 #include "MQTTExportDeclarations.h"
105 #if !defined(NO_PERSISTENCE)
113 #define MQTTASYNC_SUCCESS 0
118 #define MQTTASYNC_FAILURE -1
122 #define MQTTASYNC_PERSISTENCE_ERROR -2
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
200 #define MQTTASYNC_COMMAND_IGNORED -18
204 #define MQTTASYNC_MAX_BUFFERED -19
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
241 #define MQTTAsync_init_options_initializer { {'M', 'Q', 'T', 'G'}, 0, 0 }
334 #define MQTTAsync_message_initializer { {'M', 'Q', 'T', 'M'}, 1, 0, NULL, 0, 0, 0, 0, MQTTProperties_initializer }
489 #define MQTTAsync_connectData_initializer {{'M', 'Q', 'C', 'D'}, 0, NULL, {0, NULL}}
567 #define MQTTAsync_failureData5_initializer {{'M', 'Q', 'F', 'D'}, 0, 0, MQTTREASONCODE_SUCCESS, MQTTProperties_initializer, 0, NULL, 0}
640 #define MQTTAsync_successData5_initializer {{'M', 'Q', 'S', 'D'}, 0, 0, MQTTREASONCODE_SUCCESS, MQTTProperties_initializer, {.sub={0,0}}}
771 #define MQTTAsync_responseOptions_initializer { {'M', 'Q', 'T', 'R'}, 1, NULL, NULL, 0, 0, NULL, NULL, MQTTProperties_initializer, MQTTSubscribe_options_initializer, 0, NULL}
775 #define MQTTAsync_callOptions_initializer MQTTAsync_responseOptions_initializer
957 int persistence_type,
void* persistence_context);
1000 #define MQTTAsync_createOptions_initializer { {'M', 'Q', 'C', 'O'}, 2, 0, 100, MQTTVERSION_DEFAULT, 0, 0, 1, 1}
1002 #define MQTTAsync_createOptions_initializer5 { {'M', 'Q', 'C', 'O'}, 2, 0, 100, MQTTVERSION_5, 0, 0, 1, 1}
1049 #define MQTTAsync_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 1, NULL, NULL, 0, 0, { 0, NULL } }
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
1135 int (*ssl_error_cb) (
const char *str,
size_t len,
void *u);
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);
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 }
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}
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}
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}
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}
1478 #define MQTTAsync_disconnectOptions_initializer { {'M', 'Q', 'T', 'D'}, 0, 0, NULL, NULL, NULL,\
1479 MQTTProperties_initializer, MQTTREASONCODE_SUCCESS, NULL, NULL }
1481 #define MQTTAsync_disconnectOptions_initializer5 { {'M', 'Q', 'T', 'D'}, 1, 0, NULL, NULL, NULL,\
1482 MQTTProperties_initializer, MQTTREASONCODE_SUCCESS, NULL, NULL }
1649 #define MQTTASYNC_TRUE 1
2379 #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:253
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:430
void MQTTAsync_connectionLost(void *context, char *cause)
Definition: MQTTAsync.h:412
int MQTTAsync_messageArrived(void *context, char *topicName, int topicLen, MQTTAsync_message *message)
Definition: MQTTAsync.h:369
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:444
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_TRACE_LEVELS
Definition: MQTTAsync.h:1711
@ MQTTASYNC_TRACE_FATAL
Definition: MQTTAsync.h:1718
@ MQTTASYNC_TRACE_MEDIUM
Definition: MQTTAsync.h:1713
@ MQTTASYNC_TRACE_SEVERE
Definition: MQTTAsync.h:1717
@ MQTTASYNC_TRACE_PROTOCOL
Definition: MQTTAsync.h:1715
@ MQTTASYNC_TRACE_MINIMUM
Definition: MQTTAsync.h:1714
@ MQTTASYNC_TRACE_ERROR
Definition: MQTTAsync.h:1716
@ MQTTASYNC_TRACE_MAXIMUM
Definition: MQTTAsync.h:1712
int MQTTAsync_updateConnectOptions(void *context, MQTTAsync_connectData *data)
Definition: MQTTAsync.h:497
void MQTTAsync_onFailure(void *context, MQTTAsync_failureData *response)
Definition: MQTTAsync.h:686
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:1739
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:655
int MQTTAsync_token
Definition: MQTTAsync.h:263
MQTTAsync_nameValue * MQTTAsync_getVersionInfo(void)
const char * MQTTAsync_strerror(int code)
void MQTTAsync_onSuccess5(void *context, MQTTAsync_successData5 *response)
Definition: MQTTAsync.h:671
void MQTTAsync_onFailure5(void *context, MQTTAsync_failureData5 *response)
Definition: MQTTAsync.h:701
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:392
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)
void * MQTTAsync_malloc(size_t size)
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:1069
const char * trustStore
Definition: MQTTAsync.h:1083
int struct_version
Definition: MQTTAsync.h:1080
int disableDefaultTrustStore
Definition: MQTTAsync.h:1161
void * ssl_error_context
Definition: MQTTAsync.h:1141
unsigned int protos_len
Definition: MQTTAsync.h:1176
const char * CApath
Definition: MQTTAsync.h:1129
const char * keyStore
Definition: MQTTAsync.h:1088
int sslVersion
Definition: MQTTAsync.h:1115
const unsigned char * protos
Definition: MQTTAsync.h:1170
int enableServerCertAuth
Definition: MQTTAsync.h:1109
const char * privateKey
Definition: MQTTAsync.h:1093
int verify
Definition: MQTTAsync.h:1122
const char * enabledCipherSuites
Definition: MQTTAsync.h:1106
void * ssl_psk_context
Definition: MQTTAsync.h:1154
const char * privateKeyPassword
Definition: MQTTAsync.h:1096
Definition: MQTTAsync.h:466
int struct_version
Definition: MQTTAsync.h:470
const void * data
Definition: MQTTAsync.h:485
const char * username
Definition: MQTTAsync.h:477
int len
Definition: MQTTAsync.h:484
Definition: MQTTAsync.h:1199
int maxRetryInterval
Definition: MQTTAsync.h:1337
int cleansession
Definition: MQTTAsync.h:1245
int struct_version
Definition: MQTTAsync.h:1212
MQTTAsync_onFailure * onFailure
Definition: MQTTAsync.h:1296
const void * data
Definition: MQTTAsync.h:1343
int MQTTVersion
Definition: MQTTAsync.h:1325
int minRetryInterval
Definition: MQTTAsync.h:1333
MQTTAsync_onSuccess5 * onSuccess5
Definition: MQTTAsync.h:1362
const char * httpsProxy
Definition: MQTTAsync.h:1380
int connectTimeout
Definition: MQTTAsync.h:1271
MQTTAsync_onFailure5 * onFailure5
Definition: MQTTAsync.h:1368
int maxInflight
Definition: MQTTAsync.h:1249
int automaticReconnect
Definition: MQTTAsync.h:1329
MQTTAsync_willOptions * will
Definition: MQTTAsync.h:1255
MQTTAsync_SSLOptions * ssl
Definition: MQTTAsync.h:1284
MQTTProperties * connectProperties
Definition: MQTTAsync.h:1352
const char * password
Definition: MQTTAsync.h:1267
int serverURIcount
Definition: MQTTAsync.h:1306
char *const * serverURIs
Definition: MQTTAsync.h:1318
const char * username
Definition: MQTTAsync.h:1261
MQTTAsync_onSuccess * onSuccess
Definition: MQTTAsync.h:1290
MQTTProperties * willProperties
Definition: MQTTAsync.h:1356
const MQTTAsync_nameValue * httpHeaders
Definition: MQTTAsync.h:1372
int retryInterval
Definition: MQTTAsync.h:1279
int keepAliveInterval
Definition: MQTTAsync.h:1223
int cleanstart
Definition: MQTTAsync.h:1348
const char * httpProxy
Definition: MQTTAsync.h:1376
void * context
Definition: MQTTAsync.h:1302
int len
Definition: MQTTAsync.h:1342
Definition: MQTTAsync.h:961
int struct_version
Definition: MQTTAsync.h:969
int sendWhileDisconnected
Definition: MQTTAsync.h:971
int persistQoS0
Definition: MQTTAsync.h:997
int MQTTVersion
Definition: MQTTAsync.h:981
int restoreMessages
Definition: MQTTAsync.h:993
int maxBufferedMessages
Definition: MQTTAsync.h:975
int deleteOldestMessages
Definition: MQTTAsync.h:989
int allowDisconnectedSendAtAnyTime
Definition: MQTTAsync.h:985
Definition: MQTTAsync.h:1428
int struct_version
Definition: MQTTAsync.h:1432
MQTTAsync_onFailure * onFailure
Definition: MQTTAsync.h:1449
MQTTProperties properties
Definition: MQTTAsync.h:1459
MQTTAsync_onSuccess5 * onSuccess5
Definition: MQTTAsync.h:1469
int timeout
Definition: MQTTAsync.h:1437
MQTTAsync_onFailure5 * onFailure5
Definition: MQTTAsync.h:1475
MQTTAsync_onSuccess * onSuccess
Definition: MQTTAsync.h:1443
void * context
Definition: MQTTAsync.h:1455
Definition: MQTTAsync.h:548
int struct_version
Definition: MQTTAsync.h:552
MQTTProperties properties
Definition: MQTTAsync.h:558
const char * message
Definition: MQTTAsync.h:562
int packet_type
Definition: MQTTAsync.h:564
int code
Definition: MQTTAsync.h:560
Definition: MQTTAsync.h:536
const char * message
Definition: MQTTAsync.h:542
int code
Definition: MQTTAsync.h:540
MQTTAsync_token token
Definition: MQTTAsync.h:538
Definition: MQTTAsync.h:232
int struct_version
Definition: MQTTAsync.h:236
int do_openssl_init
Definition: MQTTAsync.h:238
Definition: MQTTAsync.h:272
int struct_version
Definition: MQTTAsync.h:277
MQTTProperties properties
Definition: MQTTAsync.h:331
int qos
Definition: MQTTAsync.h:295
int msgid
Definition: MQTTAsync.h:327
int retained
Definition: MQTTAsync.h:314
void * payload
Definition: MQTTAsync.h:281
int payloadlen
Definition: MQTTAsync.h:279
int dup
Definition: MQTTAsync.h:321
Definition: MQTTAsync.h:1183
const char * value
Definition: MQTTAsync.h:1185
const char * name
Definition: MQTTAsync.h:1184
Definition: MQTTAsync.h:709
int struct_version
Definition: MQTTAsync.h:714
MQTTAsync_onFailure * onFailure
Definition: MQTTAsync.h:726
MQTTProperties properties
Definition: MQTTAsync.h:755
MQTTSubscribe_options subscribeOptions
Definition: MQTTAsync.h:759
int subscribeOptionsCount
Definition: MQTTAsync.h:764
MQTTAsync_onSuccess5 * onSuccess5
Definition: MQTTAsync.h:745
MQTTAsync_onFailure5 * onFailure5
Definition: MQTTAsync.h:751
MQTTSubscribe_options * subscribeOptionsList
Definition: MQTTAsync.h:768
char struct_id[4]
Definition: MQTTAsync.h:711
MQTTAsync_onSuccess * onSuccess
Definition: MQTTAsync.h:720
void * context
Definition: MQTTAsync.h:732
MQTTAsync_token token
Definition: MQTTAsync.h:739
Definition: MQTTAsync.h:602
int struct_version
Definition: MQTTAsync.h:604
int MQTTVersion
Definition: MQTTAsync.h:628
MQTTProperties properties
Definition: MQTTAsync.h:608
enum MQTTReasonCodes * reasonCodes
Definition: MQTTAsync.h:616
int sessionPresent
Definition: MQTTAsync.h:629
MQTTAsync_message message
Definition: MQTTAsync.h:621
char * serverURI
Definition: MQTTAsync.h:627
int reasonCodeCount
Definition: MQTTAsync.h:615
char * destinationName
Definition: MQTTAsync.h:622
Definition: MQTTAsync.h:571
int MQTTVersion
Definition: MQTTAsync.h:593
int qos
Definition: MQTTAsync.h:579
int sessionPresent
Definition: MQTTAsync.h:594
MQTTAsync_message message
Definition: MQTTAsync.h:586
int * qosList
Definition: MQTTAsync.h:582
char * serverURI
Definition: MQTTAsync.h:592
char * destinationName
Definition: MQTTAsync.h:587
MQTTAsync_token token
Definition: MQTTAsync.h:573
Definition: MQTTAsync.h:1021
int struct_version
Definition: MQTTAsync.h:1027
const void * data
Definition: MQTTAsync.h:1045
const char * topicName
Definition: MQTTAsync.h:1029
const char * message
Definition: MQTTAsync.h:1031
int qos
Definition: MQTTAsync.h:1040
int retained
Definition: MQTTAsync.h:1035
int len
Definition: MQTTAsync.h:1044
Definition: MQTTProperties.h:113
Definition: MQTTSubscribeOpts.h:22