107 #if !defined(MQTTCLIENT_H)
110 #if defined(__cplusplus)
119 #include "MQTTExportDeclarations.h"
124 #if !defined(NO_PERSISTENCE)
132 #define MQTTCLIENT_SUCCESS 0
137 #define MQTTCLIENT_FAILURE -1
144 #define MQTTCLIENT_DISCONNECTED -3
149 #define MQTTCLIENT_MAX_MESSAGES_INFLIGHT -4
153 #define MQTTCLIENT_BAD_UTF8_STRING -5
157 #define MQTTCLIENT_NULL_PARAMETER -6
163 #define MQTTCLIENT_TOPICNAME_TRUNCATED -7
168 #define MQTTCLIENT_BAD_STRUCTURE -8
172 #define MQTTCLIENT_BAD_QOS -9
176 #define MQTTCLIENT_SSL_NOT_SUPPORTED -10
180 #define MQTTCLIENT_BAD_MQTT_VERSION -11
190 #define MQTTCLIENT_BAD_PROTOCOL -14
194 #define MQTTCLIENT_BAD_MQTT_OPTION -15
198 #define MQTTCLIENT_WRONG_MQTT_VERSION -16
202 #define MQTTCLIENT_0_LEN_WILL_TOPIC -17
208 #define MQTTVERSION_DEFAULT 0
212 #define MQTTVERSION_3_1 3
216 #define MQTTVERSION_3_1_1 4
220 #define MQTTVERSION_5 5
224 #define MQTT_BAD_SUBSCRIBE 0x80
239 #define MQTTClient_init_options_initializer { {'M', 'Q', 'T', 'G'}, 0, 0 }
332 #define MQTTClient_message_initializer { {'M', 'Q', 'T', 'M'}, 1, 0, NULL, 0, 0, 0, 0, MQTTProperties_initializer }
545 int persistence_type,
void* persistence_context);
562 #define MQTTClient_createOptions_initializer { {'M', 'Q', 'C', 'O'}, 0, MQTTVERSION_DEFAULT }
652 #define MQTTClient_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 1, NULL, NULL, 0, 0, {0, NULL} }
654 #define MQTT_SSL_VERSION_DEFAULT 0
655 #define MQTT_SSL_VERSION_TLS_1_0 1
656 #define MQTT_SSL_VERSION_TLS_1_1 2
657 #define MQTT_SSL_VERSION_TLS_1_2 3
738 int (*ssl_error_cb) (
const char *str,
size_t len,
void *u);
751 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);
782 #define MQTTClient_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 }
982 #define MQTTClient_connectOptions_initializer { {'M', 'Q', 'T', 'C'}, 8, 60, 1, 1, NULL, NULL, NULL, 30, 0, NULL,\
983 0, NULL, MQTTVERSION_DEFAULT, {NULL, 0, 0}, {0, NULL}, -1, 0, NULL, NULL, NULL}
986 #define MQTTClient_connectOptions_initializer5 { {'M', 'Q', 'T', 'C'}, 8, 60, 0, 1, NULL, NULL, NULL, 30, 0, NULL,\
987 0, NULL, MQTTVERSION_5, {NULL, 0, 0}, {0, NULL}, -1, 1, NULL, NULL, NULL}
992 #define MQTTClient_connectOptions_initializer_ws { {'M', 'Q', 'T', 'C'}, 8, 45, 1, 1, NULL, NULL, NULL, 30, 0, NULL,\
993 0, NULL, MQTTVERSION_DEFAULT, {NULL, 0, 0}, {0, NULL}, -1, 0, NULL, NULL, NULL}
998 #define MQTTClient_connectOptions_initializer5_ws { {'M', 'Q', 'T', 'C'}, 8, 45, 0, 1, NULL, NULL, NULL, 30, 0, NULL,\
999 0, NULL, MQTTVERSION_5, {NULL, 0, 0}, {0, NULL}, -1, 1, NULL, NULL, NULL}
1033 #define MQTTResponse_initializer {1, MQTTREASONCODE_SUCCESS, 0, NULL, NULL}
1380 unsigned long timeout);
1477 #if defined(__cplusplus)
void MQTTResponse_free(MQTTResponse response)
struct MQTTResponse MQTTResponse
int MQTTClient_disconnect5(MQTTClient handle, int timeout, enum MQTTReasonCodes reason, MQTTProperties *props)
int MQTTClient_disconnect(MQTTClient handle, int timeout)
void MQTTClient_free(void *ptr)
void MQTTClient_global_init(MQTTClient_init_options *inits)
void MQTTClient_setTraceCallback(MQTTClient_traceCallback *callback)
int MQTTClient_getPendingDeliveryTokens(MQTTClient handle, MQTTClient_deliveryToken **tokens)
MQTTResponse MQTTClient_publishMessage5(MQTTClient handle, const char *topicName, MQTTClient_message *msg, MQTTClient_deliveryToken *dt)
void MQTTClient_disconnected(void *context, MQTTProperties *properties, enum MQTTReasonCodes reasonCode)
Definition: MQTTClient.h:446
MQTTResponse MQTTClient_unsubscribeMany5(MQTTClient handle, int count, char *const *topic, MQTTProperties *props)
int MQTTClient_receive(MQTTClient handle, char **topicName, int *topicLen, MQTTClient_message **message, unsigned long timeout)
void MQTTClient_setTraceLevel(enum MQTTCLIENT_TRACE_LEVELS level)
int MQTTClient_unsubscribeMany(MQTTClient handle, int count, char *const *topic)
MQTTResponse MQTTClient_subscribeMany5(MQTTClient handle, int count, char *const *topic, int *qos, MQTTSubscribe_options *opts, MQTTProperties *props)
MQTTResponse MQTTClient_unsubscribe5(MQTTClient handle, const char *topic, MQTTProperties *props)
void MQTTClient_connectionLost(void *context, char *cause)
Definition: MQTTClient.h:403
void MQTTClient_published(void *context, int dt, int packet_type, MQTTProperties *properties, enum MQTTReasonCodes reasonCode)
Definition: MQTTClient.h:487
int MQTTClient_isConnected(MQTTClient handle)
int MQTTClient_deliveryToken
Definition: MQTTClient.h:262
void * MQTTClient
Definition: MQTTClient.h:251
MQTTResponse MQTTClient_publish5(MQTTClient handle, const char *topicName, int payloadlen, const void *payload, int qos, int retained, MQTTProperties *properties, MQTTClient_deliveryToken *dt)
int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken dt, unsigned long timeout)
void MQTTClient_yield(void)
int MQTTClient_setDisconnected(MQTTClient handle, void *context, MQTTClient_disconnected *co)
int MQTTClient_token
Definition: MQTTClient.h:263
int MQTTClient_subscribeMany(MQTTClient handle, int count, char *const *topic, int *qos)
int MQTTClient_setCommandTimeout(MQTTClient handle, unsigned long milliSeconds)
int MQTTClient_create(MQTTClient *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context)
void * MQTTClient_malloc(size_t size)
int MQTTClient_subscribe(MQTTClient handle, const char *topic, int qos)
const char * MQTTClient_strerror(int code)
int MQTTClient_setPublished(MQTTClient handle, void *context, MQTTClient_published *co)
MQTTCLIENT_TRACE_LEVELS
Definition: MQTTClient.h:1423
@ MQTTCLIENT_TRACE_PROTOCOL
Definition: MQTTClient.h:1427
@ MQTTCLIENT_TRACE_FATAL
Definition: MQTTClient.h:1430
@ MQTTCLIENT_TRACE_MAXIMUM
Definition: MQTTClient.h:1424
@ MQTTCLIENT_TRACE_MEDIUM
Definition: MQTTClient.h:1425
@ MQTTCLIENT_TRACE_ERROR
Definition: MQTTClient.h:1428
@ MQTTCLIENT_TRACE_MINIMUM
Definition: MQTTClient.h:1426
@ MQTTCLIENT_TRACE_SEVERE
Definition: MQTTClient.h:1429
int MQTTClient_messageArrived(void *context, char *topicName, int topicLen, MQTTClient_message *message)
Definition: MQTTClient.h:364
MQTTResponse MQTTClient_connect5(MQTTClient handle, MQTTClient_connectOptions *options, MQTTProperties *connectProperties, MQTTProperties *willProperties)
int MQTTClient_unsubscribe(MQTTClient handle, const char *topic)
int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions *options)
int MQTTClient_setCallbacks(MQTTClient handle, void *context, MQTTClient_connectionLost *cl, MQTTClient_messageArrived *ma, MQTTClient_deliveryComplete *dc)
void MQTTClient_freeMessage(MQTTClient_message **msg)
MQTTClient_nameValue * MQTTClient_getVersionInfo(void)
void MQTTClient_deliveryComplete(void *context, MQTTClient_deliveryToken dt)
Definition: MQTTClient.h:386
int MQTTClient_publishMessage(MQTTClient handle, const char *topicName, MQTTClient_message *msg, MQTTClient_deliveryToken *dt)
int MQTTClient_createWithOptions(MQTTClient *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context, MQTTClient_createOptions *options)
void MQTTClient_destroy(MQTTClient *handle)
MQTTResponse MQTTClient_subscribe5(MQTTClient handle, const char *topic, int qos, MQTTSubscribe_options *opts, MQTTProperties *props)
void MQTTClient_traceCallback(enum MQTTCLIENT_TRACE_LEVELS level, char *message)
Definition: MQTTClient.h:1451
int MQTTClient_publish(MQTTClient handle, const char *topicName, int payloadlen, const void *payload, int qos, int retained, MQTTClient_deliveryToken *dt)
This structure represents a persistent data store, used to store outbound and inbound messages,...
MQTTReasonCodes
Definition: MQTTReasonCodes.h:23
Definition: MQTTClient.h:672
const char * trustStore
Definition: MQTTClient.h:686
int struct_version
Definition: MQTTClient.h:683
int disableDefaultTrustStore
Definition: MQTTClient.h:764
void * ssl_error_context
Definition: MQTTClient.h:744
unsigned int protos_len
Definition: MQTTClient.h:779
const char * CApath
Definition: MQTTClient.h:732
const char * keyStore
Definition: MQTTClient.h:691
int sslVersion
Definition: MQTTClient.h:718
const unsigned char * protos
Definition: MQTTClient.h:773
int enableServerCertAuth
Definition: MQTTClient.h:712
const char * privateKey
Definition: MQTTClient.h:696
int verify
Definition: MQTTClient.h:725
const char * enabledCipherSuites
Definition: MQTTClient.h:709
void * ssl_psk_context
Definition: MQTTClient.h:757
const char * privateKeyPassword
Definition: MQTTClient.h:699
Definition: MQTTClient.h:825
const MQTTClient_nameValue * httpHeaders
Definition: MQTTClient.h:970
int cleansession
Definition: MQTTClient.h:870
int struct_version
Definition: MQTTClient.h:838
MQTTClient_willOptions * will
Definition: MQTTClient.h:886
const void * data
Definition: MQTTClient.h:957
int MQTTVersion
Definition: MQTTClient.h:941
const char * serverURI
Definition: MQTTClient.h:947
const char * httpsProxy
Definition: MQTTClient.h:978
int connectTimeout
Definition: MQTTClient.h:902
int sessionPresent
Definition: MQTTClient.h:949
MQTTClient_SSLOptions * ssl
Definition: MQTTClient.h:915
int reliable
Definition: MQTTClient.h:880
const char * password
Definition: MQTTClient.h:898
int serverURIcount
Definition: MQTTClient.h:919
char *const * serverURIs
Definition: MQTTClient.h:933
const char * username
Definition: MQTTClient.h:892
int retryInterval
Definition: MQTTClient.h:910
int keepAliveInterval
Definition: MQTTClient.h:848
int cleanstart
Definition: MQTTClient.h:966
const char * httpProxy
Definition: MQTTClient.h:974
int maxInflightMessages
Definition: MQTTClient.h:962
int len
Definition: MQTTClient.h:956
Definition: MQTTClient.h:549
int struct_version
Definition: MQTTClient.h:553
int MQTTVersion
Definition: MQTTClient.h:559
Definition: MQTTClient.h:230
int struct_version
Definition: MQTTClient.h:234
int do_openssl_init
Definition: MQTTClient.h:236
Definition: MQTTClient.h:272
int struct_version
Definition: MQTTClient.h:277
MQTTProperties properties
Definition: MQTTClient.h:329
int qos
Definition: MQTTClient.h:295
int msgid
Definition: MQTTClient.h:325
int retained
Definition: MQTTClient.h:314
void * payload
Definition: MQTTClient.h:281
int payloadlen
Definition: MQTTClient.h:279
int dup
Definition: MQTTClient.h:321
Definition: MQTTClient.h:792
const char * value
Definition: MQTTClient.h:794
const char * name
Definition: MQTTClient.h:793
Definition: MQTTClient.h:624
int struct_version
Definition: MQTTClient.h:630
const void * data
Definition: MQTTClient.h:648
const char * topicName
Definition: MQTTClient.h:632
const char * message
Definition: MQTTClient.h:634
int qos
Definition: MQTTClient.h:643
int retained
Definition: MQTTClient.h:638
int len
Definition: MQTTClient.h:647
Definition: MQTTProperties.h:113
Definition: MQTTClient.h:1025
enum MQTTReasonCodes * reasonCodes
Definition: MQTTClient.h:1029
enum MQTTReasonCodes reasonCode
Definition: MQTTClient.h:1027
MQTTProperties * properties
Definition: MQTTClient.h:1030
int version
Definition: MQTTClient.h:1026
int reasonCodeCount
Definition: MQTTClient.h:1028
Definition: MQTTSubscribeOpts.h:22