 |
MQTT C Client Libraries Internals
|
functions which apply to client structures
More...
#include "Clients.h"
#include <string.h>
#include <stdio.h>
functions which apply to client structures
◆ clientIDCompare()
int clientIDCompare |
( |
void * |
a, |
|
|
void * |
b |
|
) |
| |
List callback function for comparing clients by clientid.
- Parameters
-
a | first integer value |
b | second integer value |
- Returns
- boolean indicating whether a and b are equal
◆ clientSocketCompare()
int clientSocketCompare |
( |
void * |
a, |
|
|
void * |
b |
|
) |
| |
List callback function for comparing clients by socket.
- Parameters
-
a | first integer value |
b | second integer value |
- Returns
- boolean indicating whether a and b are equal
int pstclear(void *handle)
Delete all the persisted message in the client persistence directory.
Definition: MQTTPersistenceDefault.c:543
const MQTTClient_nameValue * httpHeaders
HTTP headers for websockets.
Definition: MQTTClient.h:952
const void * data
binary payload data
Definition: MQTTClient.h:636
unsigned short integer2
holds the value of a 2 byte integer property type
Definition: MQTTProperties.h:100
ListElement * current
current element in the list, for iteration
Definition: LinkedList.h:71
Persistence_get pget
A function pointer to an implementation of Persistence_get().
Definition: MQTTClientPersistence.h:235
static int MQTTClient_disconnect_internal(MQTTClient handle, int timeout)
mqttclient_mutex must be locked when you call this function, if multi threaded
Definition: MQTTClient.c:1905
size_t datalen
current length of data in buf
Definition: SocketBuffer.h:44
unsigned char all
all connect flags
Definition: MQTTPacket.h:94
void MQTTProtocol_freeClient(Clients *client)
Free a client structure.
Definition: MQTTProtocolClient.c:815
int sessionPresent
if the MQTT version is 3.1.1, the value of sessionPresent returned in the connack
Definition: MQTTClient.h:931
Utility structure where name/value pairs are needed.
Definition: MQTTAsync.h:1157
char * data
pointer to the string data
Definition: MQTTProperties.h:87
int length
mbi: byte length of all properties
Definition: MQTTProperties.h:116
Structure to hold all data for one list element.
Definition: Tree.h:63
void * ListDetachHead(List *aList)
Removes and frees an the first item in a list.
Definition: LinkedList.c:268
int(* Persistence_clear)(void *handle)
Clears the persistence store, so that it no longer contains any persisted data.
Definition: MQTTClientPersistence.h:197
int MQTTProtocol_subscribe(Clients *client, List *topics, List *qoss, int msgID, MQTTSubscribe_options *opts, MQTTProperties *props)
MQTT outgoing subscribe processing for a client.
Definition: MQTTProtocolOut.c:374
MQTTAsync_willOptions defines the MQTT "Last Will and Testament" (LWT) settings for the client.
Definition: MQTTAsync.h:995
static char * trace_destination_backup_name
the name of the backup trace file
Definition: Log.c:101
int Socket_setnonblocking(int sock)
Set a socket non-blocking, OS independently.
Definition: Socket.c:75
struct ListElementStruct * prev
pointer to previous list element
Definition: LinkedList.h:74
void MQTTClient_global_init(MQTTClient_init_options *inits)
Global init of mqtt library.
Definition: MQTTClient.c:89
MQTTClient_sslProperties defines the settings to establish an SSL/TLS connection using the OpenSSL li...
Definition: MQTTClient.h:659
size_t size
heap storage used
Definition: LinkedList.h:73
char * httpProxy
HTTP proxy for websockets.
Definition: Clients.h:148
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTAsync.h:1046
const char * username
MQTT servers that support the MQTT v3.1 protocol provide authentication and authorisation by user nam...
Definition: MQTTAsync.h:1231
int Thread_wait_sem(sem_type sem, int timeout)
Wait for a semaphore to be posted, or timeout.
Definition: Thread.c:230
unsigned char all
all connack flags
Definition: MQTTPacket.h:138
void ListAppendNoMalloc(List *aList, void *content, ListElement *newel, size_t size)
Append an already allocated ListElement and content to a list.
Definition: LinkedList.c:69
Header header
MQTT header byte.
Definition: MQTTPacket.h:216
int pstput(void *handle, char *key, int bufcount, char *buffers[], int buflens[])
Write wire message to the client persistence directory.
Definition: MQTTPersistenceDefault.c:195
int MQTTPacket_send_connect(Clients *client, int MQTTVersion, MQTTProperties *connectProperties, MQTTProperties *willProperties)
Send an MQTT CONNECT packet down a socket for V5 or later.
Definition: MQTTPacketOut.c:48
List * inboundMsgs
inbound in flight messages
Definition: Clients.h:135
int maxInflightMessages
the max number of inflight outbound messages we allow
Definition: Clients.h:133
Header header
MQTT header byte.
Definition: MQTTPacket.h:186
MQTTAsync_onSuccess * onSuccess
A pointer to a callback function to be called if the disconnect successfully completes.
Definition: MQTTAsync.h:1406
int MQTTPersistence_afterRead(void *context, char **buffer, int *buflen)
A callback which is invoked just after a read from persistence.
Definition: MQTTClientPersistence.h:275
int verify
Whether to carry out post-connect checks, including that a certificate matches the given host name.
Definition: MQTTAsync.h:1097
int ListRemove(List *aList, void *content)
Removes and frees an item in a list by comparing the pointer to the content.
Definition: LinkedList.c:257
const char * message
The LWT payload.
Definition: MQTTAsync.h:1006
int serverURIcount
The number of entries in the optional serverURIs array.
Definition: MQTTClient.h:901
bool will
will flag
Definition: MQTTPacket.h:111
int MQTTProtocol_handleSubacks(void *pack, int sock)
Process an incoming suback packet for a socket.
Definition: MQTTProtocolOut.c:392
int Socket_abortWrite(int socket)
Continue an outstanding write for a particular socket.
Definition: Socket.c:956
Data for a suback packet.
Definition: MQTTPacket.h:171
MQTTAsync_onSuccess5 * onSuccess5
A pointer to a callback function to be called if the connect successfully completes.
Definition: MQTTAsync.h:1332
size_t max_size
max size the heap has reached in bytes
Definition: Heap.h:65
ListElement * cur_clientsds
current client socket descriptor (iterator)
Definition: Socket.h:115
void * TreeRemoveNodeIndex(Tree *aTree, Node *curnode, int index)
Remove an item from a tree.
Definition: Tree.c:420
MQTTClient_willOptions * will
This is a pointer to an MQTTClient_willOptions structure.
Definition: MQTTClient.h:868
int msgId
MQTT message id.
Definition: MQTTPacket.h:187
Definition: MQTTClient.c:298
void Socket_addPendingWrite(int socket)
Add a socket to the pending write list, so that it is checked for writing in select.
Definition: Socket.c:584
int clientIDCompare(void *a, void *b)
List callback function for comparing clients by clientid.
Definition: Clients.c:36
static thread_return_type WINAPI connectionLost_call(void *context)
Wrapper function to call connection lost on a separate thread.
Definition: MQTTClient.c:679
int qos
The quality of service (QoS) assigned to the message.
Definition: MQTTClient.h:291
fd_set rset
socket read set (see select doc)
Definition: Socket.h:111
int MQTTClient_receive(MQTTClient handle, char **topicName, int *topicLen, MQTTClient_message **message, unsigned long timeout)
This function performs a synchronous receive of incoming messages.
Definition: MQTTClient.c:2688
int packet_type
Packet type on which the failure occurred - used for publish QoS 1/2 exchanges.
Definition: MQTTAsync.h:550
void SocketBuffer_freeDefQ(void)
Free the default queue memory.
Definition: SocketBuffer.c:122
Definition: MQTTAsyncUtils.h:40
builds a websocket frame for data transmission
Definition: WebSocket.c:231
void SocketBuffer_terminate(void)
Terminate the socketBuffer module.
Definition: SocketBuffer.c:133
ListElement * ListFindItem(List *aList, void *content, int(*callback)(void *, void *))
Finds an element in a list by comparing the content or pointer to the content.
Definition: LinkedList.c:154
size_t size
size of content
Definition: Tree.h:82
void * context
Definition: MQTTAsync.h:1418
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTAsync.h:260
int socketcompare(void *a, void *b)
List callback function for comparing socket_queues by socket.
Definition: SocketBuffer.c:70
void * MQTTPacket_suback(int MQTTVersion, unsigned char aHeader, char *data, size_t datalen)
Function used in the new packets table to create suback packets.
Definition: MQTTPacketOut.c:292
Definition: MQTTClient.c:333
char * topic
topic string
Definition: MQTTPacket.h:200
#define MQTTCLIENT_PERSISTENCE_ERROR
Application-specific persistence functions must return this error code if there is a problem executin...
Definition: MQTTClientPersistence.h:85
void MQTTClient_setTraceCallback(MQTTClient_traceCallback *callback)
This function sets the trace callback if needed.
Definition: MQTTClient.c:2875
void MQTTProtocol_specialChars(char *p0, char *p1, b64_size_t *basic_auth_in_len)
Allow user or password characters to be expressed in the form of XX, XX being the hexadecimal value o...
Definition: MQTTProtocolOut.c:105
Definition: MQTTProtocol.h:28
int ListRemoveHead(List *aList)
Removes and frees an the first item in a list.
Definition: LinkedList.c:294
void * payload
A pointer to the payload of the MQTT message.
Definition: MQTTClient.h:277
Definition: MQTTAsyncUtils.h:32
int readInt4(char **pptr)
Calculates an integer from two bytes read from the input buffer.
Definition: MQTTPacket.c:945
MQTT version 5 property list.
Definition: MQTTProperties.h:112
int MQTTPacket_sends(networkHandles *net, Header header, PacketBuffers *bufs, int MQTTVersion)
Sends an MQTT packet from multiple buffers in one system call write.
Definition: MQTTPacket.c:250
int pstkeys(void *handle, char ***keys, int *nkeys)
Returns the keys (file names w/o the extension) in the client persistence directory.
Definition: MQTTPersistenceDefault.c:659
struct MQTTAsync_successData::@1::@2 pub
For publish, the message being sent to the server.
#define MQTTCLIENT_PERSISTENCE_USER
This persistence_type value specifies an application-specific persistence mechanism (see MQTTClient_c...
Definition: MQTTClientPersistence.h:79
Information about the state of the heap.
Definition: Heap.h:62
int MQTTVersion
the version of MQTT
Definition: MQTTPacket.h:205
int keepAliveInterval
The "keep alive" interval, measured in seconds, defines the maximum time that should pass without com...
Definition: MQTTClient.h:830
int(* Persistence_get)(void *handle, char *key, char **buffer, int *buflen)
Retrieve the specified data from the persistent store.
Definition: MQTTClientPersistence.h:156
int len
PUBREC, PUBREL, PUBCOMP
Definition: Clients.h:63
static int MQTTProtocol_startPublishCommon(Clients *pubclient, Publish *publish, int qos, int retained)
Utility function to start a new publish exchange.
Definition: MQTTProtocolClient.c:141
void * phandle
the persistence handle
Definition: Clients.h:139
MQTTClient_persistence * persistence
a persistence implementation
Definition: Clients.h:140
char *const * serverURIs
An optional array of null-terminated strings specifying the servers to which the client will connect.
Definition: MQTTClient.h:915
static void MQTTProtocol_checkPendingWrites(void)
See if any pending writes have been completed, and cleanup if so.
Definition: MQTTClient.c:2985
int MQTTVersion
Whether the MQTT version is 3.1, 3.1.1, or 5.
Definition: MQTTAsync.h:956
char * httpsProxy
HTTPS proxy for websockets.
Definition: Clients.h:149
char * serverURI
the connection string of the server
Definition: MQTTAsync.h:578
int qos
The quality of service setting for the LWT message (see MQTTClient_message.qos and qos).
Definition: MQTTClient.h:631
networkHandles net
network info for this client
Definition: Clients.h:129
unsigned int reserved
message type nibble
Definition: MQTTPacket.h:149
int(* Persistence_close)(void *handle)
Close the persistent store referred to by the handle.
Definition: MQTTClientPersistence.h:123
Data for a packet with header only.
Definition: MQTTPacket.h:162
int code
A numeric code identifying the MQTT client library error.
Definition: MQTTAsync.h:546
void MQTTProtocol_freeMessageList(List *msgList)
Empty and free up all storage used by a message list.
Definition: MQTTProtocolClient.c:895
int MQTTPacket_send_publish(Publish *pack, int dup, int qos, int retained, networkHandles *net, const char *clientID)
Send an MQTT PUBLISH packet down a socket.
Definition: MQTTPacket.c:835
fd_set rset_saved
saved socket read set
Definition: Socket.h:112
pending_writes * SocketBuffer_getWrite(int socket)
Get any queued write data for a specific socket.
Definition: SocketBuffer.c:399
int MQTTVersion
Sets the version of MQTT to be used on the connect.
Definition: MQTTAsync.h:1295
Data for an MQTT V5 unsuback packet.
Definition: MQTTPacket.h:184
int Socket_continueWrite(int socket)
Continue an outstanding write for a particular socket.
Definition: Socket.c:871
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTAsync.h:1393
const char * privateKey
If not included in the sslKeyStore, this setting points to the file in PEM format containing the clie...
Definition: MQTTAsync.h:1068
void * MQTTPacket_ack(int MQTTVersion, unsigned char aHeader, char *data, size_t datalen)
Function used in the new packets table to create acknowledgement packets.
Definition: MQTTPacket.c:783
MQTTResponse MQTTClient_subscribeMany5(MQTTClient handle, int count, char *const *topic, int *qos, MQTTSubscribe_options *opts, MQTTProperties *props)
This function attempts to subscribe an MQTT version 5.0 client to a list of topics,...
Definition: MQTTClient.c:1957
int SocketBuffer_getQueuedChar(int socket, char *c)
Get any queued character for a specific socket.
Definition: SocketBuffer.c:219
A structure representing the payload and attributes of an MQTT message.
Definition: MQTTClient.h:267
char * destinationName
the topic destination for the message
Definition: MQTTAsync.h:608
int MQTTPersistence_initialize(Clients *c, const char *serverURI)
Open persistent store and restore any persisted messages.
Definition: MQTTPersistence.c:115
MQTTPersistence_afterRead * afterRead
persistence read callback
Definition: Clients.h:142
int ListDetach(List *aList, void *content)
Removes but does not free an item in a list by comparing the pointer to the content.
Definition: LinkedList.c:245
void Log(enum LOG_LEVELS log_level, int msgno, const char *format,...)
Log a message.
Definition: Log.c:421
int MQTTProtocol_connect(const char *ip_address, Clients *aClient, int websocket, int MQTTVersion, MQTTProperties *connectProperties, MQTTProperties *willProperties)
MQTT outgoing connect processing for a client.
Definition: MQTTProtocolOut.c:208
int MQTTClient_createWithOptions(MQTTClient *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context, MQTTClient_createOptions *options)
A version of :MQTTClient_create() with additional options.
Definition: MQTTClient.c:369
void ListFreeNoContent(List *aList)
Removes and but does not free all items in a list, and frees the list itself.
Definition: LinkedList.c:392
void * content
pointer to element content
Definition: Tree.h:81
const char * CApath
From the OpenSSL documentation: If CApath is not NULL, it points to a directory containing CA certifi...
Definition: MQTTClient.h:720
int allowDisconnectedSendAtAnyTime
Allow sending of messages while disconnected before a first successful connect.
Definition: MQTTAsync.h:960
int MQTTClient_publish(MQTTClient handle, const char *topicName, int payloadlen, const void *payload, int qos, int retained, MQTTClient_deliveryToken *deliveryToken)
This function attempts to publish a message to a given topic (see also MQTTClient_publishMessage()).
Definition: MQTTClient.c:2399
MQTTClient_libraryInfo is used to store details relating to the currently used library such as the ve...
Definition: MQTTClient.h:779
enum MQTTPropertyCodes identifier
The MQTT V5 property id.
Definition: MQTTProperties.h:96
Header header
MQTT header byte.
Definition: MQTTPacket.h:91
void MQTTPacket_freeUnsuback(Unsuback *pack)
Free allocated storage for a suback packet.
Definition: MQTTPacket.c:700
#define MQTTCLIENT_PERSISTENCE_NONE
This persistence_type value specifies a memory-based persistence mechanism (see MQTTClient_create()).
Definition: MQTTClientPersistence.h:74
struct MQTTClient_connectOptions::@19 binarypwd
Optional binary password.
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTAsync.h:697
unsigned char rc
connack reason code
Definition: MQTTPacket.h:153
const char * trustStore
The file in PEM format containing the public digital certificates trusted by the client.
Definition: MQTTAsync.h:1058
int line
the line no in the source file where it was allocated
Definition: Heap.c:71
ListElement * ListNextElement(List *aList, ListElement **pos)
Forward iteration through a list.
Definition: LinkedList.c:411
int MQTTVersion
the version of MQTT
Definition: MQTTPacket.h:175
unsigned char version
MQTT version number.
Definition: MQTTPacket.h:126
Definition: MQTTPersistence.h:84
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTAsync.h:940
Definition: StackTrace.c:46
int Socket_writev(int socket, iobuf *iovecs, int count, unsigned long *bytes)
Attempts to write a series of iovec buffers to a socket in one system call so that they are sent as o...
Definition: Socket.c:440
int MQTTPersistence_create(MQTTClient_persistence **persistence, int type, void *pcontext)
Creates a MQTTClient_persistence structure representing a persistence implementation.
Definition: MQTTPersistence.c:51
MQTTLenString value
The value of a user property.
Definition: MQTTProperties.h:104
int Thread_destroy_mutex(mutex_type mutex)
Destroy a mutex which has already been created.
Definition: Thread.c:156
char * MQTTStrncpy(char *dest, const char *src, size_t dest_size)
Copy no more than dest_size -1 characters from the string pointed to by src to the array pointed to b...
Definition: MQTTProtocolClient.c:912
char * SocketBuffer_complete(int socket)
A socket read has now completed so we can get rid of the queue.
Definition: SocketBuffer.c:281
MQTTProperties properties
MQTT 5.0 properties.
Definition: MQTTPacket.h:220
void writeData(char **pptr, const void *data, int datalen)
Writes length delimited data to an output buffer.
Definition: MQTTPacket.c:479
struct @33 valid_ranges[]
Structure to hold the valid ranges of UTF-8 characters, for each byte up to 4.
MQTTAsync_sslProperties defines the settings to establish an SSL/TLS connection using the OpenSSL lib...
Definition: MQTTAsync.h:1043
const char * message
Optional further text explaining the error.
Definition: MQTTAsync.h:548
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTAsync.h:998
int MQTTClient_publishMessage(MQTTClient handle, const char *topicName, MQTTClient_message *message, MQTTClient_deliveryToken *deliveryToken)
This function attempts to publish a message to a given topic (see also MQTTClient_publish()).
Definition: MQTTClient.c:2444
bool sessionPresent
was a session found on the server?
Definition: MQTTPacket.h:148
char * willMsg
will payload
Definition: MQTTPacket.h:123
int MQTTProtocol_handleUnsubacks(void *pack, int sock)
Process an incoming unsuback packet for a socket.
Definition: MQTTProtocolOut.c:430
cond_type Thread_create_cond(int *rc)
Create a new condition variable.
Definition: Thread.c:365
void Heap_terminate(void)
Heap termination.
Definition: Heap.c:417
int SocketBuffer_writeComplete(int socket)
A socket write has now completed so we can get rid of the queue.
Definition: SocketBuffer.c:411
static thread_return_type WINAPI call_disconnected(void *context)
Wrapper function to call disconnected on a separate thread.
Definition: MQTTClient.c:717
MQTTProperties properties
MQTT V5 properties returned, if any.
Definition: MQTTAsync.h:594
int indexes
no of indexes into tree
Definition: Tree.h:83
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:590
static int MQTTClient_disconnect1(MQTTClient handle, int timeout, int internal, int stop, enum MQTTReasonCodes, MQTTProperties *)
mqttclient_mutex must be locked when you call this function, if multi threaded
Definition: MQTTClient.c:1858
uint8_t mask[4]
array of flags indicating whether each buffer needs to be freed
Definition: Socket.h:102
int UTF8_validate(int len, const char *data)
Validate a length-delimited string has only UTF-8 characters.
Definition: utf-8.c:129
MQTTAsync_onSuccess * onSuccess
A pointer to a callback function to be called if the connect successfully completes.
Definition: MQTTAsync.h:1260
int msgId
MQTT message id.
Definition: MQTTPacket.h:217
void MQTTClient_yield(void)
When implementing a single-threaded client, call this function periodically to allow processing of me...
Definition: MQTTClient.c:2744
The connect options that can be updated before an automatic reconnect.
Definition: MQTTAsync.h:451
int serverURIcount
The number of entries in the serverURIs array.
Definition: MQTTAsync.h:1276
int retained
The retained flag for the LWT message (see MQTTClient_message.retained).
Definition: MQTTClient.h:626
Options for the ::MQTTAsync_createWithOptions call.
Definition: MQTTAsync.h:937
void Socket_outInitialize(void)
Initialize the socket module.
Definition: Socket.c:123
unsigned int integer4
holds the value of a 4 byte integer property type
Definition: MQTTProperties.h:101
thread_type Thread_start(thread_fn fn, void *parameter)
Start a new thread.
Definition: Thread.c:60
int keepAliveTimer
keepalive timeout value in seconds
Definition: MQTTPacket.h:125
const char * topicName
The LWT topic to which the LWT message will be published.
Definition: MQTTAsync.h:1004
void MQTTPacket_freeSuback(Suback *pack)
Free allocated storage for a suback packet.
Definition: MQTTPacket.c:684
thread_id_type Thread_getid(void)
Get the thread id of the thread from which this function is called.
Definition: Thread.c:176
Stored publication data to minimize copying.
Definition: Clients.h:40
int pstget(void *handle, char *key, char **buffer, int *buflen)
Retrieve a wire message from the client persistence directory.
Definition: MQTTPersistenceDefault.c:257
MQTTClient_willOptions defines the MQTT "Last Will and Testament" (LWT) settings for the client.
Definition: MQTTClient.h:611
const char * keyStore
The file in PEM format containing the public certificate chain of the client.
Definition: MQTTAsync.h:1063
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTClient.h:662
enum MQTTReasonCodes * reasonCodes
an array of reasonCodes
Definition: MQTTAsync.h:602
MQTTResponse MQTTClient_unsubscribeMany5(MQTTClient handle, int count, char *const *topic, MQTTProperties *props)
This function attempts to remove existing subscriptions to a list of topics made by the specified cli...
Definition: MQTTClient.c:2130
int Thread_check_sem(sem_type sem)
Check to see if a semaphore has been posted, without waiting The semaphore will be unchanged,...
Definition: Thread.c:292
void * context
Definition: MQTTAsync.h:1272
Data for a publish packet.
Definition: MQTTPacket.h:197
MQTTResponse MQTTClient_publishMessage5(MQTTClient handle, const char *topicName, MQTTClient_message *message, MQTTClient_deliveryToken *deliveryToken)
Attempts to publish a message to the given topic using MQTT version 5.0 (see also MQTTClient_publish5...
Definition: MQTTClient.c:2413
size_t size
heap storage used
Definition: Tree.h:85
Structure to define call options.
Definition: MQTTAsync.h:694
int clientSocketCompare(void *a, void *b)
List callback function for comparing clients by socket.
Definition: Clients.c:50
MQTTClient_connectOptions defines several settings that control the way the client connects to an MQT...
Definition: MQTTClient.h:806
int MQTTClient_subscribe(MQTTClient handle, const char *topic, int qos)
This function attempts to subscribe a client to a single topic, which may contain wildcards (see wild...
Definition: MQTTClient.c:2116
Messages * MQTTProtocol_createMessage(Publish *publish, Messages **mm, int qos, int retained, int allocatePayload)
Copy and store message data for retries.
Definition: MQTTProtocolClient.c:198
int maxfdp1
max descriptor used +1 (again see select doc)
Definition: Socket.h:113
int MQTTClient_isConnected(MQTTClient handle)
This function allows the client application to test whether or not a client is currently connected to...
Definition: MQTTClient.c:1942
MQTTAsync_SSLOptions * ssl
This is a pointer to an MQTTAsync_SSLOptions structure.
Definition: MQTTAsync.h:1254
const char * message
Optional text explaining the error.
Definition: MQTTAsync.h:528
static List * queues
List of queued input buffers.
Definition: SocketBuffer.c:50
Definition: SocketBuffer.h:48
void MQTTProtocol_closeSession(Clients *c, int sendwill)
mqttclient_mutex must be locked when you call this function, if multi threaded
Definition: MQTTClient.c:1914
int sessionExpiry
MQTT 5 session expiry.
Definition: Clients.h:147
int sendWhileDisconnected
Whether to allow messages to be sent when the client library is not connected.
Definition: MQTTAsync.h:948
int MQTTVersion
the version of MQTT being used
Definition: MQTTAsync.h:579
static List writes
List of queued write buffers.
Definition: SocketBuffer.c:55
void MQTTClient_free(void *memory)
This function frees memory allocated by the MQTT C client library, especially the topic name.
Definition: MQTTClient.c:618
Definition: MQTTPersistence.h:71
void MQTTPacket_freeConnack(Connack *pack)
Free allocated storage for a connack packet.
Definition: MQTTPacketOut.c:187
static void HeapScan(enum LOG_LEVELS log_level)
Scans the heap and reports any items currently allocated.
Definition: Heap.c:383
void Socket_close(int socket)
Close a socket and remove it from the select list.
Definition: Socket.c:634
Tree * TreeInitialize(int(*compare)(void *, void *, int))
Allocates and initializes a new tree structure.
Definition: Tree.c:65
MQTTProperties * connectProperties
MQTT V5 properties for connect.
Definition: MQTTAsync.h:1322
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)
Callback function for setting TLS-PSK options.
Definition: MQTTClient.h:739
void MQTTClient_setTraceLevel(enum MQTTCLIENT_TRACE_LEVELS level)
This function sets the level of trace information which will be returned in the trace callback.
Definition: MQTTClient.c:2869
unsigned int allow_duplicates
switch to allow duplicate entries
Definition: Tree.h:87
int cleansession
This is a boolean value.
Definition: MQTTAsync.h:1215
Persistence_put pput
A function pointer to an implementation of Persistence_put().
Definition: MQTTClientPersistence.h:231
enum MQTTReasonCodes reasonCode
The MQTT reason code returned.
Definition: MQTTAsync.h:542
void * TreeRemoveIndex(Tree *aTree, void *content, int index)
Remove an item from a tree.
Definition: Tree.c:487
int verify
Whether to carry out post-connect checks, including that a certificate matches the given host name.
Definition: MQTTClient.h:713
MQTTClient_SSLOptions * ssl
This is a pointer to an MQTTClient_SSLOptions structure.
Definition: MQTTClient.h:897
int MQTTPersistence_remove(Clients *c, char *type, int qos, int msgId)
Deletes a record from the persistent store.
Definition: MQTTPersistence.c:533
int Socket_close_only(int socket)
Close a socket without removing it from the select list.
Definition: Socket.c:606
int max_trace_entries
max no of entries in the trace buffer
Definition: Log.h:58
int len
binary payload length
Definition: MQTTClient.h:635
char lower
lower limit of valid range
Definition: utf-8.c:49
int count
no of items
Definition: LinkedList.h:72
A structure representing the payload and attributes of an MQTT message.
Definition: MQTTAsync.h:257
Definition: SocketBuffer.h:37
int dup
The dup flag indicates whether or not this message is a duplicate.
Definition: MQTTClient.h:317
MQTTAsync_onFailure5 * onFailure5
A pointer to a callback function to be called if the disconnect fails.
Definition: MQTTAsync.h:1438
int(* ssl_error_cb)(const char *str, size_t len, void *u)
Callback function for OpenSSL error handler ERR_print_errors_cb Exists only if struct_version >= 3.
Definition: MQTTAsync.h:1110
MQTTAsync_token token
A token identifying the successful request.
Definition: MQTTAsync.h:559
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)
Callback function for setting TLS-PSK options.
Definition: MQTTAsync.h:1123
int Thread_signal_cond(cond_type condvar)
Signal a condition variable.
Definition: Thread.c:399
Initialization options.
Definition: MQTTClient.h:225
char * Socket_getpeer(int sock)
Get information about the other end connected to a socket.
Definition: Socket.c:1074
Header header
MQTT header byte.
Definition: MQTTPacket.h:135
int stringcompare(void *a, void *b)
List callback function for comparing C strings.
Definition: LinkedList.c:448
const char * password
MQTT servers that support the MQTT v3.1 protocol provide authentication and authorisation by user nam...
Definition: MQTTAsync.h:1237
int len
binary password length
Definition: MQTTAsync.h:470
static int ptrCompare(void *a, void *b, int value)
List callback function for comparing storage elements.
Definition: Heap.c:114
List * reasonCodes
list of reason codes
Definition: MQTTPacket.h:190
union Connect::@21 flags
connect flags byte
struct MQTTClient_connectOptions::@18 returned
Returned from the connect when the MQTT version used to connect is 3.1.1.
int code
A numeric code identifying the error.
Definition: MQTTAsync.h:526
MQTTAsync_onSuccess * onSuccess
A pointer to a callback function to be called if the API call successfully completes.
Definition: MQTTAsync.h:706
const char * topicName
The LWT topic to which the LWT message will be published.
Definition: MQTTClient.h:620
int qos
For subscribe, the granted QoS of the subscription returned by the server.
Definition: MQTTAsync.h:565
heap_info * Heap_get_info(void)
Access to heap state.
Definition: Heap.c:432
int qos
The quality of service setting for the LWT message (see MQTTAsync_message.qos and qos).
Definition: MQTTAsync.h:1015
const char * trustStore
The file in PEM format containing the public digital certificates trusted by the client.
Definition: MQTTClient.h:674
bool willRetain
will retain setting
Definition: MQTTPacket.h:113
MQTTResponse MQTTClient_subscribe5(MQTTClient handle, const char *topic, int qos, MQTTSubscribe_options *opts, MQTTProperties *props)
This function attempts to subscribe an MQTT version 5.0 client to a single topic, which may contain w...
Definition: MQTTClient.c:2102
const char * keyStore
The file in PEM format containing the public certificate chain of the client.
Definition: MQTTClient.h:679
int MQTTVersion
the version of MQTT
Definition: MQTTPacket.h:219
int reliable
This is a boolean value that controls how many messages can be in-flight simultaneously.
Definition: MQTTClient.h:862
#define MQTTCLIENT_PERSISTENCE_DEFAULT
This persistence_type value specifies the default file system-based persistence mechanism (see MQTTCl...
Definition: MQTTClientPersistence.h:69
int cleansession
This is a boolean value.
Definition: MQTTClient.h:852
const void * data
binary password data
Definition: MQTTAsync.h:471
enum LOG_LEVELS trace_level
trace level
Definition: Log.h:57
List * connect_pending
list of sockets for which a connect is pending
Definition: Socket.h:116
void * ssl_error_context
Application-specific contex for OpenSSL error handler ERR_print_errors_cb Exists only if struct_versi...
Definition: MQTTAsync.h:1116
void MQTTPersistence_insertInOrder(List *list, void *content, size_t size)
Inserts the specified message into the list, maintaining message ID order.
Definition: MQTTPersistence.c:401
int(* Persistence_keys)(void *handle, char ***keys, int *nkeys)
Returns the keys in this persistent data store.
Definition: MQTTClientPersistence.h:186
int dup
The dup flag indicates whether or not this message is a duplicate.
Definition: MQTTAsync.h:307
MQTTAsync_onFailure * onFailure
A pointer to a callback function to be called if the disconnect fails.
Definition: MQTTAsync.h:1412
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTAsync.h:1171
Structure to hold all data for one list element.
Definition: LinkedList.h:56
int Socket_getReadySocket(int more_work, struct timeval *tp, mutex_type mutex, int *rc)
Returns the next socket ready for communications as indicated by select.
Definition: Socket.c:244
Header header
MQTT header byte.
Definition: MQTTPacket.h:164
int ListRemoveItem(List *aList, void *content, int(*callback)(void *, void *))
Removes and frees an element in a list by comparing the content.
Definition: LinkedList.c:349
struct NodeStruct * child[2]
pointers to child tree nodes 0 = left, 1 = right
Definition: Tree.h:80
bool cleanstart
cleansession flag
Definition: MQTTPacket.h:110
Configuration data related to all clients.
Definition: Clients.h:162
int enableServerCertAuth
True/False option to enable verification of the server certificate.
Definition: MQTTAsync.h:1084
size_t size
size of the allocated storage
Definition: Heap.c:73
char * readUTF(char **pptr, char *enddata)
Reads a "UTF" string from the input buffer.
Definition: MQTTPacket.c:413
int MQTTPersistence_putPacket(int socket, char *buf0, size_t buf0len, int count, char **buffers, size_t *buflens, int htype, int msgId, int scr, int MQTTVersion)
Adds a record to the persistent store.
Definition: MQTTPersistence.c:434
void MQTTClient_destroy(MQTTClient *handle)
This function frees the memory allocated to an MQTT client (see MQTTClient_create()).
Definition: MQTTClient.c:562
void * payload
A pointer to the payload of the MQTT message.
Definition: MQTTAsync.h:267
int enableServerCertAuth
True/False option to enable verification of the server certificate.
Definition: MQTTClient.h:700
unsigned int good
if we have an error on the socket we turn this off
Definition: Clients.h:126
void * MQTTPacket_connack(int MQTTVersion, unsigned char aHeader, char *data, size_t datalen)
Function used in the new packets table to create connack packets.
Definition: MQTTPacketOut.c:142
int retained
The retained flag for the LWT message (see MQTTAsync_message.retained).
Definition: MQTTAsync.h:1010
The data for a length delimited string.
Definition: MQTTProperties.h:84
Persistence_close pclose
A function pointer to an implementation of Persistence_close().
Definition: MQTTClientPersistence.h:227
int Socket_putdatas(int socket, char *buf0, size_t buf0len, PacketBuffers bufs)
Attempts to write a series of buffers to a socket in one system call so that they are sent as one pac...
Definition: Socket.c:512
int connectTimeout
The time interval in seconds to allow a connect to complete.
Definition: MQTTAsync.h:1241
char nextMessageType
used for retry and expiry
Definition: Clients.h:62
void * MQTTPacket_unsuback(int MQTTVersion, unsigned char aHeader, char *data, size_t datalen)
Function used in the new packets table to create unsuback packets.
Definition: MQTTPacketOut.c:408
int MQTTClient_subscribeMany(MQTTClient handle, int count, char *const *topic, int *qos)
This function attempts to subscribe a client to a list of topics, which may contain wildcards (see wi...
Definition: MQTTClient.c:2087
int struct_version
The version number of this structure.
Definition: MQTTClient.h:820
const MQTTAsync_nameValue * httpHeaders
HTTP headers for websockets.
Definition: MQTTAsync.h:1342
void ListZero(List *newl)
Sets a list structure to empty - all null values.
Definition: LinkedList.c:42
void MQTTPacket_freeAck(Ack *pack)
Free allocated storage for an ack packet.
Definition: MQTTPacket.c:617
char fixed_header[5]
header plus up to 4 length bytes
Definition: SocketBuffer.h:42
void SocketBuffer_cleanup(int socket)
Cleanup any buffers for a specific socket.
Definition: SocketBuffer.c:151
The data returned on completion of an unsuccessful API call in the response callback onFailure.
Definition: MQTTAsync.h:533
const char * httpsProxy
HTTPS proxy for websockets.
Definition: MQTTClient.h:960
const void * data
binary password data
Definition: MQTTClient.h:939
MQTTAsync_onFailure * onFailure
A pointer to a callback function to be called if the API call fails.
Definition: MQTTAsync.h:712
int maxBufferedMessages
The maximum number of messages allowed to be buffered while not connected.
Definition: MQTTAsync.h:950
const char * serverURI
the serverURI connected to
Definition: MQTTClient.h:929
static int lines_written
number of lines written to the current output file
Definition: Log.c:102
MQTTAsync_willOptions * will
This is a pointer to an MQTTAsync_willOptions structure.
Definition: MQTTAsync.h:1225
void MQTTProtocol_keepalive(START_TIME_TYPE now)
MQTT protocol keepAlive processing.
Definition: MQTTProtocolClient.c:660
int count
no of items
Definition: Tree.h:84
static size_t Heap_roundup(size_t size)
Round allocation size up to a multiple of the size of an int.
Definition: Heap.c:98
int msgid
The message identifier is normally reserved for internal use by the MQTT client and server.
Definition: MQTTClient.h:321
int MQTTVersion
Sets the version of MQTT to be used on the connect.
Definition: MQTTClient.h:923
int disableDefaultTrustStore
Don't load default SSL CA.
Definition: MQTTClient.h:752
MQTTAsync_message message
the message being sent to the server
Definition: MQTTAsync.h:572
int retained
The retained flag serves two purposes depending on whether the message it is associated with is being...
Definition: MQTTAsync.h:300
int MQTTClient_setDisconnected(MQTTClient handle, void *context, MQTTClient_disconnected *disconnected)
Sets the MQTTClient_disconnected() callback function for a client.
Definition: MQTTClient.c:688
union MQTTAsync_successData5::@4 alt
A union of the different values that can be returned for subscribe, unsubscribe and publish.
unsigned char retainAsPublished
To keep the retain flag as on the original publish message, set to 1.
Definition: MQTTSubscribeOpts.h:50
size_t len
length of frame
Definition: WebSocket.c:150
struct @33::@34 bytes[4]
up to 4 bytes can be used per character
unsigned char rc
MQTT 5 reason code.
Definition: MQTTPacket.h:218
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:700
Data for a connack packet.
Definition: MQTTPacket.h:133
int Thread_destroy_sem(sem_type sem)
Destroy a semaphore which has already been created.
Definition: Thread.c:341
void MQTTProtocol_retry(START_TIME_TYPE now, int doRetry, int regardless)
MQTT retry protocol and socket pending writes processing.
Definition: MQTTProtocolClient.c:784
int MQTTVersion
Whether the MQTT version is 3.1, 3.1.1, or 5.
Definition: MQTTClient.h:547
void * context
calling context - used when calling disconnect_internal
Definition: Clients.h:145
int MQTTClient_disconnect(MQTTClient handle, int timeout)
This function attempts to disconnect the client from the MQTT server.
Definition: MQTTClient.c:1920
char * SocketBuffer_getQueuedData(int socket, size_t bytes, size_t *actual_len)
Get any queued data for a specific socket.
Definition: SocketBuffer.c:176
int MQTTVersion
the version of MQTT being used, 3, 4 or 5
Definition: Clients.h:146
Structure to hold all socket data for the module.
Definition: Socket.h:109
unsigned int heap_tracking
switch on heap tracking for this tree?
Definition: Tree.h:86
int len
binary password length
Definition: MQTTAsync.h:1312
const char * privateKey
If not included in the sslKeyStore, this setting points to the file in PEM format containing the clie...
Definition: MQTTClient.h:684
const char * enabledCipherSuites
The list of cipher suites that the client will present to the server during the SSL handshake.
Definition: MQTTClient.h:697
void writeChar(char **pptr, char c)
Writes one character to an output buffer.
Definition: MQTTPacket.c:438
int len
the length of the string
Definition: MQTTProperties.h:86
const char * privateKeyPassword
The password to load the client's privateKey if encrypted.
Definition: MQTTAsync.h:1071
static void MQTTProtocol_retries(START_TIME_TYPE now, Clients *client, int regardless)
MQTT retry processing per client.
Definition: MQTTProtocolClient.c:710
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:1395
int MQTTPacket_send_subscribe(List *topics, List *qoss, MQTTSubscribe_options *opts, MQTTProperties *props, int msgid, int dup, Clients *client)
Send an MQTT subscribe packet down a socket.
Definition: MQTTPacketOut.c:228
int Thread_wait_cond(cond_type condvar, int timeout)
Wait with a timeout (seconds) for condition variable.
Definition: Thread.c:416
int timeout
The client delays disconnection for up to this time (in milliseconds) in order to allow in-flight mes...
Definition: MQTTAsync.h:1400
#define ARRAY_SIZE(a)
Macro to determine the number of elements in a single-dimension array.
Definition: utf-8.c:37
const char * enabledCipherSuites
The list of cipher suites that the client will present to the server during the SSL handshake.
Definition: MQTTAsync.h:1081
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:538
void * ssl_error_context
Application-specific contex for OpenSSL error handler ERR_print_errors_cb Exists only if struct_versi...
Definition: MQTTClient.h:732
MQTTProperties properties
MQTT V5 input properties.
Definition: MQTTAsync.h:1422
enum MQTTReasonCodes reasonCode
MQTT V5 reason code returned.
Definition: MQTTAsync.h:593
int MQTTClient_unsubscribeMany(MQTTClient handle, int count, char *const *topic)
This function attempts to remove existing subscriptions to a list of topics made by the specified cli...
Definition: MQTTClient.c:2234
int MQTTClient_setCallbacks(MQTTClient handle, void *context, MQTTClient_connectionLost *cl, MQTTClient_messageArrived *ma, MQTTClient_deliveryComplete *dc)
This function sets the callback functions for a specific client.
Definition: MQTTClient.c:1038
struct MQTTAsync_successData5::@4::@6 pub
For publish, the message being sent to the server.
pending_writes * SocketBuffer_updateWrite(int socket, char *topic, char *payload)
Update the queued write data for a socket in the case of QoS 0 messages.
Definition: SocketBuffer.c:424
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:946
char * clientID
string client id
Definition: MQTTPacket.h:121
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTClient.h:809
int sslVersion
The SSL/TLS version to use.
Definition: MQTTAsync.h:1090
int MQTTClient_unsubscribe(MQTTClient handle, const char *topic)
This function attempts to remove an existing subscription made by the specified client.
Definition: MQTTClient.c:2251
bool password
3.1 password
Definition: MQTTPacket.h:114
int Socket_getch(int socket, char *c)
Reads one byte from a socket.
Definition: Socket.c:339
int msgId
MQTT message id.
Definition: MQTTPacket.h:174
int(* Persistence_put)(void *handle, char *key, int bufcount, char *buffers[], int buflens[])
Put the specified data into the persistent store.
Definition: MQTTClientPersistence.h:140
struct MQTTClient_willOptions::@17 payload
The LWT payload in binary form.
int payloadlen
payload length
Definition: MQTTPacket.h:204
union MQTTAsync_successData::@1 alt
A union of the different values that can be returned for subscribe, unsubscribe and publish.
int maxInflight
This controls how many messages can be in-flight simultaneously.
Definition: MQTTAsync.h:1219
willMessages * will
the MQTT will message, if any
Definition: Clients.h:134
Data for a connect packet.
Definition: MQTTPacket.h:89
int Socket_continueWrites(fd_set *pwset, int *socket)
Continue any outstanding writes for a socket set.
Definition: Socket.c:990
int disableDefaultTrustStore
Don't load default SSL CA.
Definition: MQTTAsync.h:1136
int struct_version
The version number of this structure.
Definition: MQTTClient.h:273
void ListEmpty(List *aList)
Removes and frees all items in a list, leaving the list ready for new items.
Definition: LinkedList.c:359
int struct_version
The version number of this structure.
Definition: MQTTClient.h:230
int struct_version
The version number of this structure.
Definition: MQTTSubscribeOpts.h:41
int messageIDCompare(void *a, void *b)
List callback function for comparing Message structures by message id.
Definition: MQTTProtocolClient.c:65
static const char * UTF8_char_validate(int len, const char *data)
Validate a single UTF-8 character.
Definition: utf-8.c:76
int do_openssl_init
1 = we do openssl init, 0 = leave it to the application
Definition: MQTTClient.h:232
The data returned on completion of a successful API call in the response callback onSuccess.
Definition: MQTTAsync.h:587
int isReady(int socket, fd_set *read_set, fd_set *write_set)
Don't accept work from a client unless it is accepting work back, i.e.
Definition: Socket.c:222
const char * CApath
From the OpenSSL documentation: If CApath is not NULL, it points to a directory containing CA certifi...
Definition: MQTTAsync.h:1104
Persistence_keys pkeys
A function pointer to an implementation of Persistence_keys().
Definition: MQTTClientPersistence.h:243
unsigned char readChar(char **pptr)
Reads one character from the input buffer.
Definition: MQTTPacket.c:425
int max_count
max number of properties that the currently allocated array can store
Definition: MQTTProperties.h:115
static Tree heap
Tree that holds the allocation records.
Definition: Heap.c:79
MQTTResponse MQTTClient_connect5(MQTTClient handle, MQTTClient_connectOptions *options, MQTTProperties *connectProperties, MQTTProperties *willProperties)
Attempts to connect a previously-created client (see MQTTClient_create()) to an MQTT server using MQT...
Definition: MQTTClient.c:1670
Options for the ::MQTTAsync_disconnect call.
Definition: MQTTAsync.h:1390
Persistence_remove premove
A function pointer to an implementation of Persistence_remove().
Definition: MQTTClientPersistence.h:239
MQTTClient_nameValue * MQTTClient_getVersionInfo(void)
This function returns version information about the library.
Definition: MQTTClient.c:2896
int SocketBuffer_pendingWrite(int socket, int count, iobuf *iovecs, int *frees, size_t total, size_t bytes)
A socket write was interrupted so store the remaining data.
Definition: SocketBuffer.c:349
MQTTProperties properties
MQTT 5.0 properties.
Definition: MQTTPacket.h:206
MQTTProperties properties
MQTT 5.0 properties.
Definition: MQTTPacket.h:189
int MQTTProtocol_startPublish(Clients *pubclient, Publish *publish, int qos, int retained, Messages **mm)
Start a new publish exchange.
Definition: MQTTProtocolClient.c:163
int payloadlen
The length of the MQTT message payload in bytes.
Definition: MQTTClient.h:275
static FILE * trace_destination
flag to indicate if trace is to be sent to a stream
Definition: Log.c:99
int SocketBuffer_newDefQ(void)
Create a new default queue when one has just been used.
Definition: SocketBuffer.c:79
const char * MQTTClient_strerror(int code)
Returns a pointer to the string representation of the error or NULL.
Definition: MQTTClient.c:2932
Node * root
root node pointer
Definition: Tree.h:80
unsigned char byte
holds the value of a byte property type
Definition: MQTTProperties.h:99
List * ListInitialize(void)
Allocates and initializes a new list structure.
Definition: LinkedList.c:52
int HeapDump(FILE *file)
Dump the state of the heap.
Definition: Heap.c:462
List * clientsds
list of client socket descriptors
Definition: Socket.h:114
const char * username
MQTT v3.1 user name.
Definition: Clients.h:120
raw websocket frame data
Definition: WebSocket.c:148
int pstcontainskey(void *handle, char *key)
Returns whether if a wire message is persisted in the client persistence directory.
Definition: MQTTPersistenceDefault.c:405
Client will message data.
Definition: Clients.h:69
int Thread_destroy_cond(cond_type condvar)
Destroy a condition variable.
Definition: Thread.c:444
int maxInflightMessages
The maximum number of messages in flight.
Definition: MQTTClient.h:944
int pstclose(void *handle)
Delete client persistence directory (if empty).
Definition: MQTTPersistenceDefault.c:371
char *const * serverURIs
Definition: MQTTAsync.h:1288
int maxRetryInterval
Maximum retry interval in seconds.
Definition: MQTTAsync.h:1307
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTClient.h:614
int keepAliveInterval
The "keep alive" interval, measured in seconds, defines the maximum time that should pass without com...
Definition: MQTTAsync.h:1193
ListElement * ListInsert(List *aList, void *content, size_t size, ListElement *index)
Insert an item to a list at a specific position.
Definition: LinkedList.c:107
unsigned int cleanstart
MQTT V5 clean start flag.
Definition: Clients.h:124
int Socket_noPendingWrites(int socket)
Indicate whether any data is pending outbound for a socket.
Definition: Socket.c:424
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTClient.h:270
void * ListPopTail(List *aList)
Removes but does not free the last item in a list.
Definition: LinkedList.c:306
Header header
MQTT header byte.
Definition: MQTTPacket.h:173
char * payload
binary payload, length delimited
Definition: MQTTPacket.h:203
void * ssl_psk_context
Application-specific contex for ssl_psk_cb Exists only if struct_version >= 4.
Definition: MQTTAsync.h:1129
const void * password
MQTT v3.1 binary password.
Definition: Clients.h:122
int SocketBuffer_initialize(void)
Initialize the socketBuffer module.
Definition: SocketBuffer.c:102
int MQTTPacket_send_pubcomp(int MQTTVersion, int msgid, networkHandles *net, const char *clientID)
Send an MQTT PUBCOMP packet down a socket.
Definition: MQTTPacket.c:763
int struct_version
The version number of this structure.
Definition: MQTTClient.h:618
List * messageQueue
inbound complete but undelivered messages
Definition: Clients.h:137
unsigned int cleansession
MQTT V3 clean session flag.
Definition: Clients.h:123
int MQTTVersion
the version of MQTT being used
Definition: MQTTAsync.h:614
int MQTTPacket_send_pubrec(int MQTTVersion, int msgid, networkHandles *net, const char *clientID)
Send an MQTT PUBREC packet down a socket.
Definition: MQTTPacket.c:722
int MQTTPacket_send(networkHandles *net, Header header, char *buffer, size_t buflen, int freeData, int MQTTVersion)
Sends an MQTT packet in one system call write.
Definition: MQTTPacket.c:190
int msgid
The message identifier is reserved for internal use by the MQTT client and server.
Definition: MQTTAsync.h:313
const char * value
value string
Definition: MQTTAsync.h:1160
sem_type Thread_create_sem(int *rc)
Create a new semaphore.
Definition: Thread.c:190
unsigned int protos_len
The length of the vector protos vector Exists only if struct_version >= 5.
Definition: MQTTClient.h:767
static int max_lines_per_file
maximum number of lines to write to one trace file
Definition: Log.c:103
Structure to hold all data for one tree.
Definition: Tree.h:76
void * ptr
pointer to the allocated storage
Definition: Heap.c:72
List * outboundMsgs
outbound in flight messages
Definition: Clients.h:136
Each item on the heap is recorded with this structure.
Definition: Heap.c:68
const char * username
MQTT servers that support the MQTT v3.1 protocol provide authentication and authorisation by user nam...
Definition: MQTTAsync.h:463
Options for the MQTTClient_createWithOptions call.
Definition: MQTTClient.h:536
int Socket_new(const char *addr, size_t addr_len, int port, int *sock)
Create a new socket and TCP connect to an address/port.
Definition: Socket.c:678
Publications * MQTTProtocol_storePublication(Publish *publish, int *len)
Store message data for possible retry.
Definition: MQTTProtocolClient.c:254
int(* ssl_error_cb)(const char *str, size_t len, void *u)
Callback function for OpenSSL error handler ERR_print_errors_cb Exists only if struct_version >= 3.
Definition: MQTTClient.h:726
Persistence_open popen
A function pointer to an implementation of Persistence_open().
Definition: MQTTClientPersistence.h:223
int Thread_post_sem(sem_type sem)
Post a semaphore.
Definition: Thread.c:313
int UTF8_validateString(const char *string)
Validate a null-terminated string has only UTF-8 characters.
Definition: utf-8.c:156
int MQTTPacket_encode(char *buf, size_t length)
Encodes the message length according to the MQTT algorithm.
Definition: MQTTPacket.c:297
char * destinationName
the topic destination for the message
Definition: MQTTAsync.h:573
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:456
unsigned int connected
whether it is currently connected
Definition: Clients.h:125
ListElement * ListAppend(List *aList, void *content, size_t size)
Append an item to a list.
Definition: LinkedList.c:90
size_t MQTTProtocol_addressPort(const char *uri, int *port, const char **topic, int default_port)
Separates an address:port into two separate values.
Definition: MQTTProtocolOut.c:54
size_t current_size
current size of the heap in bytes
Definition: Heap.h:64
void * beforeWrite_context
context to be used with the persistence beforeWrite callbacks
Definition: Clients.h:143
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTSubscribeOpts.h:38
static int ListUnlink(List *aList, void *content, int(*callback)(void *, void *), int freeContent)
Removes and optionally frees an element in a list by comparing the content.
Definition: LinkedList.c:201
int retryInterval
The time interval in seconds after which unacknowledged publish requests are retried during a TCP ses...
Definition: MQTTAsync.h:1249
void MQTTProtocol_emptyMessageList(List *msgList)
Empty a message list, leaving it able to accept new messages.
Definition: MQTTProtocolClient.c:874
static const char * packet_names[]
List of the predefined MQTT v3/v5 packet names.
Definition: MQTTPacket.c:50
int MQTTProtocol_unsubscribe(Clients *client, List *topics, int msgID, MQTTProperties *props)
MQTT outgoing unsubscribe processing for a client.
Definition: MQTTProtocolOut.c:413
#define _unlink
_unlink mapping for linux
Definition: Log.c:59
char ** buffers
number of buffers/buflens/frees
Definition: Socket.h:99
static char * readUTFlen(char **pptr, char *enddata, int *len)
Reads a "UTF" string from the input buffer.
Definition: MQTTPacket.c:380
const char * password
MQTT servers that support the MQTT v3.1.1 protocol provide authentication and authorisation by user n...
Definition: MQTTClient.h:880
int MQTTPacket_send_unsubscribe(List *topics, MQTTProperties *props, int msgid, int dup, Clients *client)
Send an MQTT unsubscribe packet down a socket.
Definition: MQTTPacketOut.c:359
const char * username
MQTT servers that support the MQTT v3.1.1 protocol provide authentication and authorisation by user n...
Definition: MQTTClient.h:874
Data for one of the ack packets.
Definition: MQTTPacket.h:214
char * MQTTStrdup(const char *src)
Duplicate a string, safely, allocating space on the heap.
Definition: MQTTProtocolClient.c:937
void * MQTTPacket_header_only(int MQTTVersion, unsigned char aHeader, char *data, size_t datalen)
Function used in the new packets table to create packets which have only a header.
Definition: MQTTPacket.c:495
void Socket_outTerminate(void)
Terminate the socket module.
Definition: Socket.c:152
Definition: MQTTAsyncUtils.h:148
Definition: MQTTProperties.c:28
const char * httpProxy
HTTP proxy for websockets.
Definition: MQTTAsync.h:1346
Persistence_containskey pcontainskey
A function pointer to an implementation of Persistence_containskey().
Definition: MQTTClientPersistence.h:251
unsigned char retainHandling
0 - send retained messages at the time of the subscribe (original MQTT behaviour) 1 - send retained m...
Definition: MQTTSubscribeOpts.h:55
int Socket_error(char *aString, int sock)
Gets the specific error corresponding to SOCKET_ERROR.
Definition: Socket.c:102
int MQTTClient_create(MQTTClient *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context)
This function creates an MQTT client ready for connection to the specified server and using the speci...
Definition: MQTTClient.c:513
MQTTAsync_onSuccess5 * onSuccess5
A pointer to a callback function to be called if the disconnect successfully completes.
Definition: MQTTAsync.h:1432
int MQTTPersistence_restoreMessageQueue(Clients *c)
Restores a queue of messages from persistence to memory.
Definition: MQTTPersistence.c:856
const char * Messages_get(int index, enum LOG_LEVELS log_level)
Get a log message by its index.
Definition: Messages.c:94
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:1055
int readInt(char **pptr)
Calculates an integer from two bytes read from the input buffer.
Definition: MQTTPacket.c:359
void * TreeAddByIndex(Tree *aTree, void *content, size_t size, int index)
Add an item to a tree.
Definition: Tree.c:210
int websocket
socket has been upgraded to use web sockets
Definition: Clients.h:92
const char * privateKeyPassword
The password to load the client's privateKey if encrypted.
Definition: MQTTClient.h:687
Initialization options.
Definition: MQTTAsync.h:217
Persistence_clear pclear
A function pointer to an implementation of Persistence_clear().
Definition: MQTTClientPersistence.h:247
void MQTTPersistence_wrapMsgID(Clients *client)
Checks whether the message IDs wrapped by looking for the largest gap between two consecutive message...
Definition: MQTTPersistence.c:605
int qos
The quality of service (QoS) assigned to the message.
Definition: MQTTAsync.h:281
MQTTAsync_token token
A token identifying the failed request.
Definition: MQTTAsync.h:524
int msgId
MQTT message id.
Definition: MQTTPacket.h:202
static heap_info state
global heap state information
Definition: Heap.c:58
int retryInterval
The time interval in seconds after which unacknowledged publish requests are retried during a TCP ses...
Definition: MQTTClient.h:892
int(* compare)(void *, void *, int)
comparison function
Definition: Tree.h:81
MQTTAsync_token token
A token is returned from the call.
Definition: MQTTAsync.h:724
List * qoss
list of granted QoSs (MQTT 3/4) / reason codes (MQTT 5)
Definition: MQTTPacket.h:177
const unsigned char * protos
The protocol-lists must be in wire-format, which is defined as a vector of non-empty,...
Definition: MQTTAsync.h:1145
int Thread_lock_mutex(mutex_type mutex)
Lock a mutex which has alrea.
Definition: Thread.c:112
void SocketBuffer_queueChar(int socket, char c)
Queued a Charactor to a specific socket.
Definition: SocketBuffer.c:303
int pending_socketcompare(void *a, void *b)
List callback function for comparing pending_writes by socket.
Definition: SocketBuffer.c:388
void * afterRead_context
context to be used with the persistence afterRead callback
Definition: Clients.h:144
MQTTResponse MQTTClient_unsubscribe5(MQTTClient handle, const char *topic, MQTTProperties *props)
This function attempts to remove an existing subscription made by the specified client using MQTT 5....
Definition: MQTTClient.c:2242
int msgID
the MQTT message id
Definition: Clients.h:130
const unsigned char * protos
The protocol-lists must be in wire-format, which is defined as a vector of non-empty,...
Definition: MQTTClient.h:761
int MQTTPersistence_clear(Clients *c)
Clears the persistent store.
Definition: MQTTPersistence.c:166
static socket_queue * def_queue
Default input queue buffer.
Definition: SocketBuffer.c:45
uint8_t mask[4]
the websockets mask the payload is masked with, if any
Definition: MQTTPacket.h:207
static int MQTTPacket_send_ack(int MQTTVersion, int type, int msgid, int dup, networkHandles *net)
Send an MQTT acknowledgement packet down a socket.
Definition: MQTTPacket.c:636
int passwordlen
MQTT password length.
Definition: Clients.h:121
MQTTProperties properties
The MQTT V5 properties associated with the message.
Definition: MQTTClient.h:325
const char * name
name string
Definition: MQTTAsync.h:1159
int * frees
array of lengths of buffers
Definition: Socket.h:101
int MQTTClient_getPendingDeliveryTokens(MQTTClient handle, MQTTClient_deliveryToken **tokens)
This function sets a pointer to an array of delivery tokens for messages that are currently in-flight...
Definition: MQTTClient.c:2828
int MQTTPersistence_close(Clients *c)
Close persistent store.
Definition: MQTTPersistence.c:137
MQTTProperties properties
The MQTT V5 properties associated with the message.
Definition: MQTTAsync.h:317
MQTTProperties properties
MQTT 5.0 properties.
Definition: MQTTPacket.h:176
MQTTAsync_onFailure5 * onFailure5
A pointer to a callback function to be called if the connect fails.
Definition: MQTTAsync.h:1338
int pstremove(void *handle, char *key)
Delete a persisted message from the client persistence directory.
Definition: MQTTPersistenceDefault.c:322
MQTTProperties properties
The MQTT properties on the ack, if any.
Definition: MQTTAsync.h:544
MQTTProperties * willProperties
MQTT V5 properties for the will message in the connect.
Definition: MQTTAsync.h:1326
The data returned on completion of a successful API call in the response callback onSuccess.
Definition: MQTTAsync.h:556
A structure containing the function pointers to a persistence implementation and the context or state...
Definition: MQTTClientPersistence.h:215
int keepAliveInterval
the MQTT keep alive interval
Definition: Clients.h:131
struct MQTTAsync_successData5::@4::@5 sub
For subscribeMany, the list of reasonCodes returned by the server.
int MQTTVersion
the version of MQTT
Definition: MQTTPacket.h:188
The data returned on completion of an unsuccessful API call in the response callback onFailure.
Definition: MQTTAsync.h:521
char * Socket_getaddrname(struct sockaddr *sa, int sock)
Convert a numeric address to character string.
Definition: Socket.c:1036
Structure to hold all data for one list.
Definition: LinkedList.h:67
Structure to hold an MQTT version 5 property of any type.
Definition: MQTTProperties.h:94
This structure represents a persistent data store, used to store outbound and inbound messages,...
const char * httpProxy
HTTP proxy for websockets.
Definition: MQTTClient.h:956
MQTTResponse MQTTClient_publish5(MQTTClient handle, const char *topicName, int payloadlen, const void *payload, int qos, int retained, MQTTProperties *properties, MQTTClient_deliveryToken *deliveryToken)
Attempts to publish a message to a given topic using MQTT version 5.0 (see also MQTTClient_publishMes...
Definition: MQTTClient.c:2259
const char * message
The LWT payload in string form.
Definition: MQTTClient.h:622
MQTTPersistence_beforeWrite * beforeWrite
persistence write callback
Definition: Clients.h:141
enum MQTTReasonCodes reasonCode
Reason code for MQTTV5 disconnect.
Definition: MQTTAsync.h:1426
MQTTProperties properties
MQTT 5.0 properties.
Definition: MQTTPacket.h:155
struct MQTTAsync_connectData::@0 binarypwd
The password parameter of the MQTT authentication.
struct MQTTAsync_connectOptions::@10 binarypwd
Optional binary password.
void MQTTPacket_free_packet(MQTTPacket *pack)
Free allocated storage for a various packet tyoes.
Definition: MQTTPacket.c:905
const char * httpsProxy
HTTPS proxy for websockets.
Definition: MQTTAsync.h:1350
void * mymalloc(char *file, int line, size_t size)
Allocates a block of memory.
Definition: Heap.c:158
int len
number of elements in the following array (1 to 4)
Definition: utf-8.c:46
MQTTAsync_connectOptions defines several settings that control the way the client connects to an MQTT...
Definition: MQTTAsync.h:1168
void * context
A pointer to any application-specific context.
Definition: MQTTAsync.h:718
size_t buflen
total length of the buffer
Definition: SocketBuffer.h:43
MQTT version 5.0 response information.
Definition: MQTTClient.h:998
unsigned int protos_len
The length of the vector protos vector Exists only if struct_version >= 5.
Definition: MQTTAsync.h:1151
ListElement * last
last element in the list
Definition: LinkedList.h:70
char struct_id[4]
The eyecatcher for this structure.
Definition: MQTTClient.h:539
Data related to one client.
Definition: Clients.h:117
ListElement * ListFind(List *aList, void *content)
Finds an element in a list by comparing the content pointers, rather than the contents.
Definition: LinkedList.c:140
void Heap_unlink(char *file, int line, void *p)
Remove an item from the recorded heap without actually freeing it.
Definition: Heap.c:300
size_t pos
current position within the buffer
Definition: WebSocket.c:151
int Thread_unlock_mutex(mutex_type mutex)
Unlock a mutex which has already been locked.
Definition: Thread.c:133
ListElement * first
first element in the list
Definition: LinkedList.h:69
pf new_packets[]
Array of functions to build packets, indexed according to packet code.
Definition: MQTTPacket.c:73
void * context
A pointer to any data required to initialize the persistent store.
Definition: MQTTClientPersistence.h:219
int Heap_initialize(void)
Heap initialization.
Definition: Heap.c:406
char * willTopic
will topic
Definition: MQTTPacket.h:122
const void * data
binary payload data
Definition: MQTTAsync.h:1020
mutex_type Thread_create_mutex(int *rc)
Create a new mutex.
Definition: Thread.c:88
unsigned char noLocal
To not receive our own publications, set to 1.
Definition: MQTTSubscribeOpts.h:45
MQTTAsync_onFailure * onFailure
A pointer to a callback function to be called if the connect fails.
Definition: MQTTAsync.h:1266
MQTTAsync_onFailure5 * onFailure5
A pointer to a callback function to be called if the API call successfully completes.
Definition: MQTTAsync.h:736
void MQTTPacket_freePublish(Publish *pack)
Free allocated storage for a publish packet.
Definition: MQTTPacket.c:601
void writeUTF(char **pptr, const char *string)
Writes a "UTF" string to an output buffer.
Definition: MQTTPacket.c:464
ListElement * ListPrevElement(List *aList, ListElement **pos)
Backward iteration through a list.
Definition: LinkedList.c:424
int count
number of property entries in the array
Definition: MQTTProperties.h:114
Sockets mod_s
Structure to hold all socket data for this module.
Definition: Socket.c:67
int MQTTProtocol_handlePubrecs(void *pack, int sock)
Process an incoming pubrec packet for a socket.
Definition: MQTTProtocolClient.c:457
char * Protocol
MQTT protocol name.
Definition: MQTTPacket.h:120
const char * MQTTPacket_name(int ptype)
Converts an MQTT packet code into its name.
Definition: MQTTPacket.c:65
void writeInt(char **pptr, int anInt)
Writes an integer as 2 bytes to an output buffer.
Definition: MQTTPacket.c:450
int MQTTPacket_send_pubrel(int MQTTVersion, int msgid, int dup, networkHandles *net, const char *clientID)
Send an MQTT PUBREL packet down a socket.
Definition: MQTTPacket.c:743
MQTTProperty * array
array of properties
Definition: MQTTProperties.h:117
void Log_stackTrace(enum LOG_LEVELS log_level, int msgno, int thread_id, int current_depth, const char *name, int line, int *rc)
The reason for this function is to make trace logging as fast as possible so that the function exit/e...
Definition: Log.c:452
void MQTTClient_freeMessage(MQTTClient_message **message)
This function frees memory allocated to an MQTT message, including the additional memory allocated to...
Definition: MQTTClient.c:607
const void * data
binary password data
Definition: MQTTAsync.h:1313
union Connack::@23 flags
connack flags byte
Definition: StackTrace.c:53
int MQTTVersion
current MQTT version being used to connect
Definition: MQTTAsyncUtils.h:83
static char * trace_destination_name
the name of the trace file
Definition: Log.c:100
MQTTAsync_message message
the message being sent to the server
Definition: MQTTAsync.h:607
char upper
upper limit of valid range
Definition: utf-8.c:50
int retained
The retained flag serves two purposes depending on whether the message it is associated with is being...
Definition: MQTTClient.h:310
int ListDetachItem(List *aList, void *content, int(*callback)(void *, void *))
Removes but does not free an element in a list by comparing the content.
Definition: LinkedList.c:335
int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions *options)
This function attempts to connect a previously-created client (see MQTTClient_create()) to an MQTT se...
Definition: MQTTClient.c:1656
void SocketBuffer_interrupted(int socket, size_t actual_len)
A socket read was interrupted so we need to queue data.
Definition: SocketBuffer.c:252
int reasonCodeCount
the number of reason codes in the reasonCodes array
Definition: MQTTAsync.h:601
int struct_version
The version number of this structure.
Definition: MQTTClient.h:671
static int Internal_heap_unlink(char *file, int line, void *p)
Remove an item from the recorded heap without actually freeing it.
Definition: Heap.c:245
char * FindString(char *filename, const char *eyecatcher_input)
Finds an eyecatcher in a binary file and returns the following value.
Definition: MQTTVersion.c:74
MQTTProperties properties
MQTT V5 input properties.
Definition: MQTTAsync.h:740
int(* Persistence_open)(void **handle, const char *clientID, const char *serverURI, void *context)
Initialize the persistent store.
Definition: MQTTClientPersistence.h:113
void * MQTTPacket_Factory(int MQTTVersion, networkHandles *net, int *error)
Reads one MQTT packet from a socket.
Definition: MQTTPacket.c:103
int sslVersion
The SSL/TLS version to use.
Definition: MQTTClient.h:706
int pstopen(void **handle, const char *clientID, const char *serverURI, void *context)
Create persistence directory for the client: context/clientID-serverURI.
Definition: MQTTPersistenceDefault.c:65
int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken mdt, unsigned long timeout)
This function is called by the client application to synchronize execution of the main thread with co...
Definition: MQTTClient.c:2786
Definition: MQTTAsyncUtils.h:88
int do_openssl_init
1 = we do openssl init, 0 = leave it to the application
Definition: MQTTAsync.h:224
int MQTTPacket_VBIdecode(int(*getcharfn)(char *, int), unsigned int *value)
Decodes the message length according to the MQTT algorithm.
Definition: MQTTPacket.c:1012
char * Socket_getdata(int socket, size_t bytes, size_t *actual_len, int *rc)
Attempts to read a number of bytes from a socket, non-blocking.
Definition: Socket.c:377
void MQTTResponse_free(MQTTResponse response)
Frees the storage associated with the MQTT response.
Definition: MQTTClient.c:626
Header header
MQTT header byte.
Definition: MQTTPacket.h:199
int automaticReconnect
Reconnect automatically in the case of a connection being lost?
Definition: MQTTAsync.h:1299
int Socket_addSocket(int newSd)
Add a socket to the list of socket to check with select.
Definition: Socket.c:170
MQTTAsync_onSuccess5 * onSuccess5
A pointer to a callback function to be called if the API call successfully completes.
Definition: MQTTAsync.h:730
int pstmkdir(char *pPathname)
Function to create a directory.
Definition: MQTTPersistenceDefault.c:165
int MQTTPersistence_beforeWrite(void *context, int bufcount, char *buffers[], int buflens[])
A callback which is invoked just before a write to persistence.
Definition: MQTTClientPersistence.h:264
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:263
void writeInt4(char **pptr, int anInt)
Writes an integer as 4 bytes to an output buffer.
Definition: MQTTPacket.c:925
void ListFree(List *aList)
Removes and frees all items in a list, and frees the list itself.
Definition: LinkedList.c:381
void Socket_clearPendingWrite(int socket)
Clear a socket from the pending write list - if one was added with Socket_addPendingWrite.
Definition: Socket.c:594
int MQTTPacket_send_puback(int MQTTVersion, int msgid, networkHandles *net, const char *clientID)
Send an MQTT PUBACK packet down a socket.
Definition: MQTTPacket.c:668
char * file
the name of the source file where the storage was allocated
Definition: Heap.c:70
int MQTTClient_setCommandTimeout(MQTTClient handle, unsigned long milliSeconds)
Sets the timeout value for un/subscribe commands when waiting for the un/suback response from the ser...
Definition: MQTTClient.c:2881
int(* Persistence_containskey)(void *handle, char *key)
Returns whether any data has been persisted using the specified key.
Definition: MQTTClientPersistence.h:208
int MQTTProtocol_handlePingresps(void *pack, int sock)
Process an incoming pingresp packet for a socket.
Definition: MQTTProtocolOut.c:351
int len
binary payload length
Definition: MQTTAsync.h:1019
int connectTimeout
The time interval in seconds to allow a connect to complete.
Definition: MQTTClient.h:884
int MQTTProtocol_handlePubrels(void *pack, int sock)
Process an incoming pubrel packet for a socket.
Definition: MQTTProtocolClient.c:526
int MQTTPacket_send_pingreq(networkHandles *net, const char *clientID)
Send an MQTT PINGREQ packet down a socket.
Definition: MQTTPacketOut.c:203
struct MQTTAsync_successData5::@4::@8 unsub
For unsubscribeMany, the list of reasonCodes returned by the server.
int minRetryInterval
Minimum retry interval in seconds.
Definition: MQTTAsync.h:1303
static int clientSockCompare(void *a, void *b)
List callback function for comparing clients by socket.
Definition: MQTTClient.c:666
void * MQTTPersistence_restorePacket(int MQTTVersion, char *buffer, size_t buflen)
Returns a MQTT packet restored from persisted data.
Definition: MQTTPersistence.c:363
int MQTTProtocol_handlePubcomps(void *pack, int sock)
Process an incoming pubcomp packet for a socket.
Definition: MQTTProtocolClient.c:605
void * ssl_psk_context
Application-specific contex for ssl_psk_cb Exists only if struct_version >= 4.
Definition: MQTTClient.h:745
void MQTTProtocol_removePublication(Publications *p)
Remove stored message data.
Definition: MQTTProtocolClient.c:287
List * write_pending
list of sockets for which a write is pending
Definition: Socket.h:117
int MQTTProtocol_handlePublishes(void *pack, int sock)
Process an incoming publish packet for a socket The payload field of the packet has not been transfer...
Definition: MQTTProtocolClient.c:309
int HeapDumpString(FILE *file, char *str)
Dump a string from the heap so that it can be displayed conveniently.
Definition: Heap.c:443
void * MQTTPacket_publish(int MQTTVersion, unsigned char aHeader, char *data, size_t datalen)
Function used in the new packets table to create publish packets.
Definition: MQTTPacket.c:553
int len
binary password length
Definition: MQTTClient.h:938
int MQTTProtocol_handlePubacks(void *pack, int sock)
Process an incoming puback packet for a socket.
Definition: MQTTProtocolClient.c:411
struct ListElementStruct * next
pointer to next list element
Definition: LinkedList.h:75
bool username
3.1 user name
Definition: MQTTPacket.h:115
int payloadlen
The length of the MQTT message payload in bytes.
Definition: MQTTAsync.h:265
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:222
int MQTTPacket_send_disconnect(Clients *client, enum MQTTReasonCodes reason, MQTTProperties *props)
Send an MQTT disconnect packet down a socket.
Definition: MQTTPacket.c:508
int MQTTProtocol_assignMsgId(Clients *client)
Assign a new message id for a client.
Definition: MQTTProtocolClient.c:78
int sessionPresent
the session present flag returned from the server
Definition: MQTTAsync.h:615
MQTTLenString data
The value of a string property, or the name of a user property.
Definition: MQTTProperties.h:103
int sessionPresent
the session present flag returned from the server
Definition: MQTTAsync.h:580
MQTTAsync_token token
A token identifying the successful request.
Definition: MQTTAsync.h:592
void * myrealloc(char *file, int line, void *p, size_t size)
Reallocates a block of memory.
Definition: Heap.c:320
struct MQTTAsync_willOptions::@9 payload
The LWT payload in binary form.
void * content
pointer to element content
Definition: LinkedList.h:76
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:1002
int MQTTPersistence_restorePackets(Clients *c)
Restores the persisted records to the outbound and inbound message queues of the client.
Definition: MQTTPersistence.c:185
char * serverURI
the connection string of the server
Definition: MQTTAsync.h:613
void myfree(char *file, int line, void *p)
Frees a block of memory.
Definition: Heap.c:277
int struct_version
The version number of this structure.
Definition: MQTTAsync.h:1182
int MQTTPacket_decode(networkHandles *net, size_t *value)
Decodes the message length according to the MQTT algorithm.
Definition: MQTTPacket.c:325
size_t * buflens
array of byte buffers
Definition: Socket.h:100
char * clientID
the string id of the client
Definition: Clients.h:119
The MQTT V5 subscribe options, apart from QoS which existed before V5.
Definition: MQTTSubscribeOpts.h:21
unsigned int MQTTVersion
the version of MQTT
Definition: MQTTPacket.h:154
Definition: MQTTProtocol.h:35
MQTTAsync_token token
A token identifying the failed request.
Definition: MQTTAsync.h:540
struct NodeStruct * parent
pointer to parent tree node, in case we need it
Definition: Tree.h:79
Client publication message data.
Definition: Clients.h:53
int struct_version
The version number of this structure.
Definition: MQTTClient.h:541
int intcompare(void *a, void *b)
List callback function for comparing integers.
Definition: LinkedList.c:436
unsigned int willQoS
will QoS value
Definition: MQTTPacket.h:112
void * Heap_findItem(void *p)
Utility to find an item in the heap.
Definition: Heap.c:368
fd_set pending_wset
socket pending write set for select
Definition: Socket.h:118
int * qosList
For subscribeMany, if more than one subscription was requested, the list of granted QoSs of the subsc...
Definition: MQTTAsync.h:568
int(* Persistence_remove)(void *handle, char *key)
Remove the data for the specified key from the store.
Definition: MQTTClientPersistence.h:169