48 #if !defined(_WIN32) && !defined(_WIN64) 53 #if !defined(NO_PERSISTENCE) 66 #include <openssl/ssl.h> 68 #define URI_SSL "ssl://" 73 #define URI_TCP "tcp://" 74 #define URI_WS "ws://" 75 #define URI_WSS "wss://" 77 #include "VersionInfo.h" 103 #if defined(_WIN32) || defined(_WIN64) 109 #if !defined(NO_HEAP_TRACKING) 124 printf(
"mqttclient_mutex error %d\n", rc);
130 printf(
"subscribe_mutex error %d\n", rc);
136 printf(
"unsubscribe_mutex error %d\n", rc);
142 printf(
"connect_mutex error %d\n", rc);
145 #if !defined(NO_HEAP_TRACKING) 146 if ((
stack_mutex = CreateMutex(NULL, 0, NULL)) == NULL)
149 printf(
"stack_mutex error %d\n", rc);
152 if ((
heap_mutex = CreateMutex(NULL, 0, NULL)) == NULL)
155 printf(
"heap_mutex error %d\n", rc);
159 if ((
log_mutex = CreateMutex(NULL, 0, NULL)) == NULL)
162 printf(
"log_mutex error %d\n", rc);
165 if ((
socket_mutex = CreateMutex(NULL, 0, NULL)) == NULL)
168 printf(
"socket_mutex error %d\n", rc);
176 void MQTTClient_cleanup(
void)
184 #if !defined(NO_HEAP_TRACKING) 198 #if defined(PAHO_MQTT_STATIC) 200 static INIT_ONCE g_InitOnce = INIT_ONCE_STATIC_INIT;
203 BOOL CALLBACK InitOnceFunction (
213 BOOL APIENTRY DllMain(HANDLE hModule,
214 DWORD ul_reason_for_call,
217 switch (ul_reason_for_call)
219 case DLL_PROCESS_ATTACH:
222 case DLL_THREAD_ATTACH:
224 case DLL_THREAD_DETACH:
226 case DLL_PROCESS_DETACH:
228 MQTTClient_cleanup();
253 pthread_mutexattr_t attr;
256 pthread_mutexattr_init(&attr);
257 #if !defined(_WRS_KERNEL) 258 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
263 printf(
"MQTTClient: error %d initializing client_mutex\n", rc);
264 else if ((rc = pthread_mutex_init(
socket_mutex, &attr)) != 0)
265 printf(
"MQTTClient: error %d initializing socket_mutex\n", rc);
267 printf(
"MQTTClient: error %d initializing subscribe_mutex\n", rc);
269 printf(
"MQTTClient: error %d initializing unsubscribe_mutex\n", rc);
270 else if ((rc = pthread_mutex_init(
connect_mutex, &attr)) != 0)
271 printf(
"MQTTClient: error %d initializing connect_mutex\n", rc);
315 MQTTClient_authHandle* auth_handle;
316 void* auth_handle_context;
339 char** topicName,
int* topicLen,
349 const char* serverURI,
int MQTTVersion,
370 #if (defined(_WIN32) || defined(_WIN64)) && defined(PAHO_MQTT_STATIC) 372 BOOL bStatus = InitOnceExecuteOnce(&g_InitOnce, InitOnceFunction, NULL, NULL);
378 if (serverURI == NULL || clientId == NULL)
396 if (strstr(serverURI,
"://") != NULL)
419 #if !defined(NO_HEAP_TRACKING) 442 else if (strncmp(
URI_WS, serverURI, strlen(
URI_WS)) == 0)
444 serverURI += strlen(
URI_WS);
477 memset(m->
c,
'\0',
sizeof(
Clients));
489 #if !defined(NO_PERSISTENCE) 508 int persistence_type,
void* persistence_context)
511 persistence_context, NULL);
525 #if !defined(NO_HEAP_TRACKING) 571 #if !defined(NO_PERSISTENCE) 580 free(saved_clientid);
605 free((*message)->payload);
642 if (strlen(*topicName) != *topicLen)
644 #if !defined(NO_PERSISTENCE) 746 int MQTTClient_setHandleAuth(
MQTTClient handle,
void*
context, MQTTClient_handleAuth* auth_handle)
758 m->auth_handle_context =
context;
759 m->auth_handle = auth_handle;
853 Log(
TRACE_MIN, -1,
"Calling messageArrived for client %s, queue depth %d",
864 #if !defined(NO_PERSISTENCE) 871 Log(
TRACE_MIN, -1,
"False returned from messageArrived for client %s, message remains on queue",
940 if ((m->
rc = getsockopt(m->
c->
net.
socket, SOL_SOCKET, SO_ERROR, (
char*)&error, &len)) == 0)
949 rc = m->
c->sslopts->struct_version >= 3 ?
951 m->
c->sslopts->verify, m->
c->sslopts->ssl_error_cb, m->
c->sslopts->ssl_error_context) :
953 m->
c->sslopts->verify, NULL, NULL);
957 m->
c->session = SSL_get1_session(m->
c->
net.ssl);
981 #if defined(_WIN32) || defined(_WIN64) 1010 if (conn_count == 0)
1016 while (
running && ++count < 100)
1069 #if defined(OPENSSL) 1070 SSL_SESSION_free(client->session);
1071 client->session = NULL;
1077 #if defined(OPENSSL) 1078 client->
net.ssl = NULL;
1095 #if !defined(NO_PERSISTENCE) 1128 publish->
topic = NULL;
1129 if (allocatePayload)
1155 #if !defined(NO_PERSISTENCE) 1169 int sessionPresent = 0;
1185 Log(
TRACE_MIN, -1,
"Connecting to serverURI %s with MQTT version %d", serverURI, MQTTVersion);
1186 #if defined(OPENSSL) 1187 #if defined(__GNUC__) && defined(__linux__) 1194 #if defined(__GNUC__) && defined(__linux__) 1220 #if defined(OPENSSL) 1224 size_t hostname_len;
1226 int setSocketForSSLrc = 0;
1236 serverURI, hostname_len);
1240 if (m->
c->session != NULL)
1241 if ((rc = SSL_set_session(m->
c->
net.ssl, m->
c->session)) != 1)
1242 Log(
TRACE_MIN, -1,
"Failed to set SSL session with stored data, non critical");
1243 rc = m->
c->sslopts->struct_version >= 3 ?
1245 m->
c->sslopts->verify, m->
c->sslopts->ssl_error_cb, m->
c->sslopts->ssl_error_context) :
1247 m->
c->sslopts->verify, NULL, NULL);
1274 m->
c->session = SSL_get1_session(m->
c->
net.ssl);
1311 #if defined(OPENSSL) 1323 m->
c->session = SSL_get1_session(m->
c->
net.ssl);
1378 if (MQTTVersion == 4)
1379 sessionPresent = connack->
flags.
bits.sessionPresent;
1432 int proposed = keepalive / 10;
1436 else if (proposed > 5)
1450 int MQTTVersion = 0;
1489 const void* source = NULL;
1526 #if defined(OPENSSL) 1529 if (m->
c->sslopts->trustStore)
1530 free((
void*)m->
c->sslopts->trustStore);
1531 if (m->
c->sslopts->keyStore)
1532 free((
void*)m->
c->sslopts->keyStore);
1533 if (m->
c->sslopts->privateKey)
1534 free((
void*)m->
c->sslopts->privateKey);
1535 if (m->
c->sslopts->privateKeyPassword)
1536 free((
void*)m->
c->sslopts->privateKeyPassword);
1537 if (m->
c->sslopts->enabledCipherSuites)
1538 free((
void*)m->
c->sslopts->enabledCipherSuites);
1539 if (m->
c->sslopts->struct_version >= 2)
1541 if (m->
c->sslopts->CApath)
1542 free((
void*)m->
c->sslopts->CApath);
1544 free(m->
c->sslopts);
1545 m->
c->sslopts = NULL;
1568 if (m->
c->sslopts->struct_version >= 1)
1570 if (m->
c->sslopts->struct_version >= 2)
1572 m->
c->sslopts->verify = options->
ssl->
verify;
1576 if (m->
c->sslopts->struct_version >= 3)
1581 if (m->
c->sslopts->struct_version >= 4)
1587 if (m->
c->sslopts->struct_version >= 5)
1589 m->
c->sslopts->protos = options->
ssl->
protos;
1625 connectProperties, willProperties);
1629 connectProperties, willProperties);
1634 connectProperties, willProperties);
1691 if (options == NULL)
1703 #if defined(OPENSSL) 1704 if (m->ssl && options->
ssl == NULL)
1735 #if defined(OPENSSL) 1793 else if (strncmp(
URI_WS, serverURI, strlen(
URI_WS)) == 0)
1795 serverURI += strlen(
URI_WS);
1798 #if defined(OPENSSL) 1827 if (m && m->
c && m->
c->
will)
1852 int was_connected = 0;
1855 if (m == NULL || m->
c == NULL)
1880 if (call_connection_lost && m->
cl && was_connected)
1961 if (m == NULL || m->
c == NULL)
1971 for (i = 0; i <
count; i++)
1979 if (qos[i] < 0 || qos[i] > 2)
1993 for (i = 0; i <
count; i++)
1995 ListAppend(topics, topic[i], strlen(topic[i]));
2047 int* reqqos = (
int*)(current->
content);
2132 if (m == NULL || m->
c == NULL)
2142 for (i = 0; i <
count; i++)
2157 for (i = 0; i <
count; i++)
2158 ListAppend(topics, topic[i], strlen(topic[i]));
2261 if (m == NULL || m->
c == NULL)
2302 memset(p->
mask,
'\0',
sizeof(p->
mask));
2312 memcpy(p->
payload, payload, payloadlen);
2349 if (writing == NULL)
2359 if (deliveryToken && qos > 0)
2360 *deliveryToken = msg->
msgid;
2396 rc =
MQTTClient_publish5(handle, topicName, payloadlen, payload, qos, retained, NULL, deliveryToken);
2408 if (message == NULL)
2414 if (strncmp(message->
struct_id,
"MQTM", 4) != 0 ||
2425 message->
qos, message->
retained, props, deliveryToken);
2438 if (strncmp(message->
struct_id,
"MQTM", 4) != 0 ||
2470 struct timeval tp = {0L, 0L};
2477 tp.tv_sec = (long)(timeout / 1000);
2478 tp.tv_usec = (long)((timeout % 1000) * 1000);
2481 #if defined(OPENSSL) 2487 #if defined(OPENSSL) 2572 if (((
MQTTClients*)handle) == NULL || timeout <= 0L)
2585 else if (packet_type ==
CONNACK)
2587 else if (packet_type ==
SUBACK)
2591 if (*rc == 0 && packet_type !=
CONNECT && m->
pack == NULL)
2592 Log(
LOG_ERROR, -1,
"waitfor unexpectedly is NULL for client %s, packet_type %d, timeout %ld", m->
c->
clientID, packet_type, timeout);
2613 if ((*rc = getsockopt(m->
c->
net.
socket, SOL_SOCKET, SO_ERROR, (
char*)&error, &len)) == 0)
2617 #if defined(OPENSSL) 2621 *rc = m->
c->sslopts->struct_version >= 3 ?
2623 m->
c->sslopts->verify, m->
c->sslopts->ssl_error_cb, m->
c->sslopts->ssl_error_context) :
2625 m->
c->sslopts->verify, NULL, NULL);
2631 m->
c->session = SSL_get1_session(m->
c->
net.ssl);
2650 if (getsockopt(m->
c->
net.
socket, SOL_SOCKET, SO_ERROR, (
char*)&error, &len) == 0)
2675 unsigned long timeout)
2683 if (m == NULL || m->
c == NULL
2706 MQTTClient_cycle(&sock, (timeout > elapsed) ? timeout - elapsed : 0L, &rc);
2716 while (elapsed < timeout && m->
c->messageQueue->count == 0);
2748 MQTTClient_cycle(&sock, (timeout > elapsed) ? timeout - elapsed : 0L, &rc);
2759 while (elapsed < timeout);
2782 if (m == NULL || m->
c == NULL)
2789 while (elapsed < timeout)
2843 (*tokens)[count++] = m->
msgid;
2845 (*tokens)[
count] = -1;
2869 #define MAX_INFO_STRINGS 8 2873 libinfo[i].
name =
"Product name";
2874 libinfo[i++].
value =
"Eclipse Paho Synchronous MQTT C Client Library";
2876 libinfo[i].
name =
"Version";
2877 libinfo[i++].
value = CLIENT_VERSION;
2879 libinfo[i].
name =
"Build level";
2880 libinfo[i++].
value = BUILD_TIMESTAMP;
2881 #if defined(OPENSSL) 2882 libinfo[i].
name =
"OpenSSL version";
2883 libinfo[i++].
value = SSLeay_version(SSLEAY_VERSION);
2885 libinfo[i].
name =
"OpenSSL flags";
2886 libinfo[i++].
value = SSLeay_version(SSLEAY_CFLAGS);
2888 libinfo[i].
name =
"OpenSSL build timestamp";
2889 libinfo[i++].
value = SSLeay_version(SSLEAY_BUILT_ON);
2891 libinfo[i].
name =
"OpenSSL platform";
2892 libinfo[i++].
value = SSLeay_version(SSLEAY_PLATFORM);
2894 libinfo[i].
name =
"OpenSSL directory";
2895 libinfo[i++].
value = SSLeay_version(SSLEAY_DIR);
2897 libinfo[i].
name = NULL;
2898 libinfo[i].
value = NULL;
2905 static char buf[30];
2913 return "Disconnected";
2915 return "Maximum in-flight messages amount reached";
2917 return "Invalid UTF8 string";
2919 return "Invalid (NULL) parameter";
2921 return "Topic containing NULL characters has been truncated";
2923 return "Bad structure";
2925 return "Invalid QoS value";
2927 return "SSL is not supported";
2929 return "Unrecognized MQTT version";
2931 return "Invalid protocol scheme";
2933 return "Options for wrong MQTT version";
2935 return "Client created for another version of MQTT";
2937 return "Zero length will topic on connect";
2940 sprintf(buf,
"Unknown error code %d", code);
int Thread_post_sem(sem_type sem)
MQTTProperties properties
int MQTTClient_disconnect5(MQTTClient handle, int timeout, enum MQTTReasonCodes reason, MQTTProperties *props)
int WebSocket_proxy_connect(networkHandles *net, int ssl, const char *hostname)
static mutex_type connect_mutex
void MQTTProtocol_removePublication(Publications *p)
MQTTProperties properties
int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken mdt, unsigned long timeout)
int MQTTProtocol_handlePubacks(void *pack, int sock)
#define PROXY_CONNECT_IN_PROGRESS
static MQTTResponse MQTTClient_connectURIVersion(MQTTClient handle, MQTTClient_connectOptions *options, const char *serverURI, int MQTTVersion, START_TIME_TYPE start, ELAPSED_TIME_TYPE millisecsTimeout, MQTTProperties *connectProperties, MQTTProperties *willProperties)
MQTTProperties properties
static int MQTTClient_disconnect_internal(MQTTClient handle, int timeout)
#define MQTTCLIENT_FAILURE
int MQTTClient_receive(MQTTClient handle, char **topicName, int *topicLen, MQTTClient_message **message, unsigned long timeout)
enum MQTTReasonCodes reasonCode
#define WebSocket_CLOSE_NORMAL
const char * currentServerURI
void WebSocket_close(networkHandles *net, int status_code, const char *reason)
int MQTTPersistence_clear(Clients *c)
MQTTResponse MQTTClient_publish5(MQTTClient handle, const char *topicName, int payloadlen, const void *payload, int qos, int retained, MQTTProperties *properties, MQTTClient_deliveryToken *deliveryToken)
#define MQTTCLIENT_SUCCESS
sem_type Thread_create_sem(int *rc)
void MQTTProtocol_freeClient(Clients *client)
struct MQTTClient_connectOptions::@57 returned
int MQTTClient_isConnected(MQTTClient handle)
#define MQTT_DEFAULT_PORT
static mutex_type heap_mutex
int UTF8_validateString(const char *string)
int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions *options)
int MQTTProtocol_handlePubcomps(void *pack, int sock)
int SSLSocket_setSocketForSSL(networkHandles *net, MQTTClient_SSLOptions *opts, const char *hostname, size_t hostname_len)
void WebSocket_terminate(void)
static int MQTTClient_cleanSession(Clients *client)
static pthread_mutex_t socket_mutex_store
int MQTTClient_publish(MQTTClient handle, const char *topicName, int payloadlen, const void *payload, int qos, int retained, MQTTClient_deliveryToken *deliveryToken)
MQTTResponse MQTTClient_unsubscribeMany5(MQTTClient handle, int count, char *const *topic, MQTTProperties *props)
void Log_setTraceLevel(enum LOG_LEVELS level)
int MQTTProtocol_connect(const char *ip_address, Clients *aClient, int websocket, int MQTTVersion, MQTTProperties *connectProperties, MQTTProperties *willProperties)
DIFF_TIME_TYPE MQTTTime_difftime(START_TIME_TYPE new, START_TIME_TYPE old)
int MQTTClient_messageArrived(void *context, char *topicName, int topicLen, MQTTClient_message *message)
void MQTTClient_connectionLost(void *context, char *cause)
#define MQTTCLIENT_PERSISTENCE_ERROR
int MQTTClient_disconnect(MQTTClient handle, int timeout)
static mutex_type mqttclient_mutex
void MQTTProperties_free(MQTTProperties *props)
#define MQTTCLIENT_BAD_QOS
MQTTClient_published * published
static int MQTTClient_deliverMessage(int rc, MQTTClients *m, char **topicName, int *topicLen, MQTTClient_message **message)
void MQTTPacket_freeConnack(Connack *pack)
int Socket_noPendingWrites(int socket)
struct Connack::@62::@63 bits
void MQTTClient_disconnected(void *context, MQTTProperties *properties, enum MQTTReasonCodes reasonCode)
#define PAHO_MEMORY_ERROR
const MQTTClient_nameValue * httpHeaders
int MQTTPacket_send_connect(Clients *client, int MQTTVersion, MQTTProperties *connectProperties, MQTTProperties *willProperties)
const char * enabledCipherSuites
int Socket_getReadySocket(int more_work, struct timeval *tp, mutex_type mutex)
int MQTTProtocol_handlePublishes(void *pack, int sock)
int Thread_lock_mutex(mutex_type mutex)
int MQTTPacket_send_disconnect(Clients *client, enum MQTTReasonCodes reason, MQTTProperties *props)
int SSLSocket_connect(SSL *ssl, int sock, const char *hostname, int verify, int(*cb)(const char *str, size_t len, void *u), void *u)
static void MQTTClient_emptyMessageQueue(Clients *client)
static thread_return_type WINAPI connectionLost_call(void *context)
static l_noret error(LoadState *S, const char *why)
int MQTTClient_createWithOptions(MQTTClient *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context, MQTTClient_createOptions *options)
#define MQTTCLIENT_BAD_MQTT_VERSION
int MQTTClient_init(void)
#define MQTTCLIENT_BAD_STRUCTURE
int ListRemove(List *aList, void *content)
MQTTResponse MQTTClient_unsubscribe5(MQTTClient handle, const char *topic, MQTTProperties *props)
long elapsed(START_TIME_TYPE start_time)
#define MQTTCLIENT_MAX_MESSAGES_INFLIGHT
START_TIME_TYPE MQTTTime_start_clock(void)
enum MQTTReasonCodes * reasonCodes
void Log_setTraceCallback(Log_traceCallback *callback)
MQTTProperties properties
int MQTTProperties_getNumericValue(MQTTProperties *props, enum MQTTPropertyCodes propid)
START_TIME_TYPE lastTouch
#define MQTTClient_message_initializer
enum MQTTReasonCodes reasonCode
#define MQTTCLIENT_WRONG_MQTT_VERSION
#define MQTTCLIENT_BAD_UTF8_STRING
void MQTTResponse_free(MQTTResponse response)
const char * client_timestamp_eye
static mutex_type stack_mutex
static mutex_type unsubscribe_mutex
int disableDefaultTrustStore
int MQTTClient_setDisconnected(MQTTClient handle, void *context, MQTTClient_disconnected *disconnected)
void MQTTClient_setTraceLevel(enum MQTTCLIENT_TRACE_LEVELS level)
void MQTTClient_global_init(MQTTClient_init_options *inits)
static pthread_mutex_t connect_mutex_store
void Socket_setWriteCompleteCallback(Socket_writeComplete *mywritecomplete)
static thread_return_type WINAPI MQTTClient_run(void *n)
MQTTClient_messageArrived * ma
int MQTTProtocol_handleUnsubacks(void *pack, int sock)
int MQTTClient_setCallbacks(MQTTClient handle, void *context, MQTTClient_connectionLost *cl, MQTTClient_messageArrived *ma, MQTTClient_deliveryComplete *dc)
void ListEmpty(List *aList)
MQTTProperties MQTTProperties_copy(const MQTTProperties *props)
#define MQTTCLIENT_BAD_MQTT_OPTION
MQTTClient_SSLOptions * ssl
static MQTTPacket * MQTTClient_cycle(int *sock, ELAPSED_TIME_TYPE timeout, int *rc)
static void MQTTClient_retry(void)
void MQTTClient_setTraceCallback(MQTTClient_traceCallback *callback)
int MQTTClient_publishMessage(MQTTClient handle, const char *topicName, MQTTClient_message *message, MQTTClient_deliveryToken *deliveryToken)
static int MQTTClient_disconnect1(MQTTClient handle, int timeout, int internal, int stop, enum MQTTReasonCodes, MQTTProperties *)
static int clientSockCompare(void *a, void *b)
static pthread_mutex_t unsubscribe_mutex_store
ListElement * ListNextElement(List *aList, ListElement **pos)
const char * MQTTClient_strerror(int code)
void MQTTProtocol_keepalive(START_TIME_TYPE now)
#define MQTTCLIENT_0_LEN_WILL_TOPIC
static pthread_mutex_t subscribe_mutex_store
static void MQTTClient_writeComplete(int socket, int rc)
MQTTResponse MQTTClient_publishMessage5(MQTTClient handle, const char *topicName, MQTTClient_message *message, MQTTClient_deliveryToken *deliveryToken)
static mutex_type log_mutex
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)
MQTTClient_nameValue * MQTTClient_getVersionInfo(void)
static MQTTResponse MQTTClient_connectURI(MQTTClient handle, MQTTClient_connectOptions *options, const char *serverURI, MQTTProperties *connectProperties, MQTTProperties *willProperties)
#define MQTTCLIENT_BAD_PROTOCOL
MQTTClient_persistence * persistence
void SSLSocket_handleOpensslInit(int bool_value)
int MQTTClient_unsubscribe(MQTTClient handle, const char *topic)
static ClientStates ClientState
int Thread_unlock_mutex(mutex_type mutex)
struct MQTTClient_willOptions::@56 payload
void MQTTClient_published(void *context, int dt, int packet_type, MQTTProperties *properties, enum MQTTReasonCodes reasonCode)
void Log(enum LOG_LEVELS log_level, int msgno, const char *format,...)
int WebSocket_upgrade(networkHandles *net)
void * MQTTPacket_Factory(int MQTTVersion, networkHandles *net, int *error)
#define MQTTCLIENT_NULL_PARAMETER
static void MQTTClient_closeSession(Clients *client, enum MQTTReasonCodes reason, MQTTProperties *props)
void MQTTProtocol_retry(START_TIME_TYPE now, int doRetry, int regardless)
MQTTProperties properties
const unsigned char * protos
void MQTTTime_sleep(ELAPSED_TIME_TYPE milliseconds)
static thread_return_type WINAPI call_disconnected(void *context)
int MQTTProtocol_unsubscribe(Clients *client, List *topics, int msgID, MQTTProperties *props)
void MQTTClient_freeMessage(MQTTClient_message **message)
ListElement * ListAppend(List *aList, void *content, size_t size)
int SSLSocket_getPendingRead(void)
void MQTTClient_yield(void)
static mutex_type subscribe_mutex
int MQTTPersistence_restoreMessageQueue(Clients *c)
#define WEBSOCKET_IN_PROGRESS
static thread_id_type run_id
void MQTTClient_destroy(MQTTClient *handle)
void Protocol_processPublication(Publish *publish, Clients *client, int allocatePayload)
MQTTResponse MQTTClient_connect5(MQTTClient handle, MQTTClient_connectOptions *options, MQTTProperties *connectProperties, MQTTProperties *willProperties)
int MQTTPersistence_close(Clients *c)
#define MQTTCLIENT_PERSISTENCE_DEFAULT
#define MQTTCLIENT_SSL_NOT_SUPPORTED
const MQTTClient_nameValue * httpHeaders
void MQTTClient_traceCallback(enum MQTTCLIENT_TRACE_LEVELS level, char *message)
MQTTProperties properties
void * disconnected_context
void MQTTClient_deliveryComplete(void *context, MQTTClient_deliveryToken dt)
static volatile int library_initialized
int SSLSocket_close(networkHandles *net)
int MQTTProperties_hasProperty(MQTTProperties *props, enum MQTTPropertyCodes propid)
#define MQTT_BAD_SUBSCRIBE
const char * client_version_eye
unsigned int ping_outstanding
int MQTTClient_setPublished(MQTTClient handle, void *context, MQTTClient_published *published)
static mutex_type socket_mutex
char * MQTTStrdup(const char *src)
int Thread_wait_sem(sem_type sem, int timeout)
int SSLSocket_initialize(void)
MQTTProperties * properties
int MQTTClient_subscribe(MQTTClient handle, const char *topic, int qos)
void Heap_terminate(void)
static int retryLoopInterval
int MQTTProtocol_handlePingresps(void *pack, int sock)
int Heap_initialize(void)
MQTTResponse MQTTClient_subscribe5(MQTTClient handle, const char *topic, int qos, MQTTSubscribe_options *opts, MQTTProperties *props)
int MQTTPersistence_unpersistQueueEntry(Clients *client, MQTTPersistence_qEntry *qe)
int messageIDCompare(void *a, void *b)
static void MQTTClient_terminate(void)
int MQTTPersistence_create(MQTTClient_persistence **persistence, int type, void *pcontext)
pending_writes * SocketBuffer_getWrite(int socket)
void MQTTProtocol_emptyMessageList(List *msgList)
#define thread_return_type
thread_id_type Thread_getid(void)
void MQTTClient_free(void *memory)
int Log_initialize(Log_nameValue *info)
#define MQTTCLIENT_DISCONNECTED
#define MQTTResponse_initializer
START_TIME_TYPE MQTTTime_now(void)
int MQTTProtocol_handlePubrels(void *pack, int sock)
MQTTResponse MQTTClient_connectAll(MQTTClient handle, MQTTClient_connectOptions *options, MQTTProperties *connectProperties, MQTTProperties *willProperties)
void MQTTProtocol_closeSession(Clients *c, int sendwill)
int MQTTProtocol_subscribe(Clients *client, List *topics, List *qoss, int msgID, MQTTSubscribe_options *opts, MQTTProperties *props)
int MQTTClient_subscribeMany(MQTTClient handle, int count, char *const *topic, int *qos)
int MQTTClient_deliveryToken
int MQTTClient_getPendingDeliveryTokens(MQTTClient handle, MQTTClient_deliveryToken **tokens)
List * ListInitialize(void)
#define ELAPSED_TIME_TYPE
int WebSocket_connect(networkHandles *net, const char *uri)
void Log_traceCallback(enum LOG_LEVELS level, const char *message)
int MQTTProtocol_handleSubacks(void *pack, int sock)
int MQTTClient_unsubscribeMany(MQTTClient handle, int count, char *const *topic)
thread_type Thread_start(thread_fn fn, void *parameter)
size_t MQTTProtocol_addressPort(const char *uri, int *port, const char **topic, int default_port)
int Thread_destroy_sem(sem_type sem)
static void setRetryLoopInterval(int keepalive)
void ListFreeNoContent(List *aList)
#define MQTTCLIENT_TOPICNAME_TRUNCATED
int MQTTProtocol_handlePubrecs(void *pack, int sock)
#define TCPSOCKET_COMPLETE
static void MQTTProtocol_checkPendingWrites(void)
int MQTTProtocol_startPublish(Clients *pubclient, Publish *publish, int qos, int retained, Messages **mm)
MQTTProperties properties
ListElement * ListFindItem(List *aList, void *content, int(*callback)(void *, void *))
const char * privateKeyPassword
void Socket_close(int socket)
MQTTClient_connectionLost * cl
void ListFree(List *aList)
int MQTTPersistence_persistQueueEntry(Clients *aclient, MQTTPersistence_qEntry *qe)
void Socket_outInitialize(void)
MQTTClient_deliveryComplete * dc
int MQTTClient_create(MQTTClient *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context)
ELAPSED_TIME_TYPE MQTTTime_elapsed(START_TIME_TYPE milliseconds)
static int MQTTClient_stop(void)
#define MQTTVERSION_DEFAULT
MQTTClient_willOptions * will
int(* ssl_error_cb)(const char *str, size_t len, void *u)
int MQTTPersistence_initialize(Clients *c, const char *serverURI)
MQTTProperties * properties
#define TCPSOCKET_INTERRUPTED
unsigned int cleansession
MQTTClient_disconnected * disconnected
static pthread_mutex_t mqttclient_mutex_store
MQTTResponse MQTTClient_subscribeMany5(MQTTClient handle, int count, char *const *topic, int *qos, MQTTSubscribe_options *opts, MQTTProperties *props)
static MQTTPacket * MQTTClient_waitfor(MQTTClient handle, int packet_type, int *rc, ELAPSED_TIME_TYPE timeout)
int MQTTProtocol_assignMsgId(Clients *client)
struct MQTTClient_connectOptions::@58 binarypwd
#define MQTTProperties_initializer