#include "LinkedList.h"
#include "MQTTPacket.h"
#include "Log.h"
#include "MQTTProtocol.h"
#include "Messages.h"
#include "MQTTProperties.h"
Go to the source code of this file.
Macros | |
#define | MAX_CLIENTID_LEN 65535 |
#define | MAX_MSG_ID 65535 |
#define MAX_CLIENTID_LEN 65535 |
Definition at line 32 of file MQTTProtocolClient.h.
#define MAX_MSG_ID 65535 |
Definition at line 31 of file MQTTProtocolClient.h.
int messageIDCompare | ( | void * | a, |
void * | b | ||
) |
List callback function for comparing Message structures by message id
a | first integer value |
b | second integer value |
Definition at line 65 of file MQTTProtocolClient.c.
int MQTTProtocol_assignMsgId | ( | Clients * | client | ) |
Assign a new message id for a client. Make sure it isn't already being used and does not exceed the maximum.
client | a client structure |
Definition at line 78 of file MQTTProtocolClient.c.
void MQTTProtocol_closeSession | ( | Clients * | c, |
int | sendwill | ||
) |
mqttclient_mutex must be locked when you call this function, if multi threaded
Definition at line 3917 of file MQTTAsync.c.
Messages* MQTTProtocol_createMessage | ( | Publish * | publish, |
Messages ** | mm, | ||
int | qos, | ||
int | retained, | ||
int | allocatePayload | ||
) |
Copy and store message data for retries
publish | the publication data |
mm | - pointer to the message data to store |
qos | the MQTT QoS to use |
retained | boolean - whether to set the MQTT retained flag |
allocatePayload | boolean - whether or not to malloc payload |
Definition at line 196 of file MQTTProtocolClient.c.
void MQTTProtocol_emptyMessageList | ( | List * | msgList | ) |
Empty a message list, leaving it able to accept new messages
msgList | the message list to empty |
Definition at line 862 of file MQTTProtocolClient.c.
void MQTTProtocol_freeClient | ( | Clients * | client | ) |
Free a client structure
client | the client data to free |
Definition at line 811 of file MQTTProtocolClient.c.
void MQTTProtocol_freeMessageList | ( | List * | msgList | ) |
Empty and free up all storage used by a message list
msgList | the message list to empty and free |
Definition at line 883 of file MQTTProtocolClient.c.
int MQTTProtocol_handlePubacks | ( | void * | pack, |
int | sock | ||
) |
Process an incoming puback packet for a socket
pack | pointer to the publish packet |
sock | the socket on which the packet was received |
Definition at line 407 of file MQTTProtocolClient.c.
int MQTTProtocol_handlePubcomps | ( | void * | pack, |
int | sock | ||
) |
Process an incoming pubcomp packet for a socket
pack | pointer to the publish packet |
sock | the socket on which the packet was received |
Definition at line 601 of file MQTTProtocolClient.c.
int MQTTProtocol_handlePublishes | ( | void * | pack, |
int | sock | ||
) |
Process an incoming publish packet for a socket The payload field of the packet has not been transferred to another buffer at this point. If it's needed beyond the scope of this function, it has to be copied.
pack | pointer to the publish packet |
sock | the socket on which the packet was received |
Definition at line 305 of file MQTTProtocolClient.c.
int MQTTProtocol_handlePubrecs | ( | void * | pack, |
int | sock | ||
) |
Process an incoming pubrec packet for a socket
pack | pointer to the publish packet |
sock | the socket on which the packet was received |
Definition at line 453 of file MQTTProtocolClient.c.
int MQTTProtocol_handlePubrels | ( | void * | pack, |
int | sock | ||
) |
Process an incoming pubrel packet for a socket
pack | pointer to the publish packet |
sock | the socket on which the packet was received |
Definition at line 522 of file MQTTProtocolClient.c.
void MQTTProtocol_keepalive | ( | START_TIME_TYPE | now | ) |
MQTT protocol keepAlive processing. Sends PINGREQ packets as required.
now | current time |
Definition at line 656 of file MQTTProtocolClient.c.
void MQTTProtocol_removePublication | ( | Publications * | p | ) |
Remove stored message data. Opposite of storePublication
p | stored publication to remove |
Definition at line 285 of file MQTTProtocolClient.c.
void MQTTProtocol_retry | ( | START_TIME_TYPE | now, |
int | doRetry, | ||
int | regardless | ||
) |
MQTT retry protocol and socket pending writes processing.
now | current time |
doRetry | boolean - retries as well as pending writes? |
regardless | boolean - retry packets regardless of retry interval (used on reconnect) |
Definition at line 780 of file MQTTProtocolClient.c.
int MQTTProtocol_startPublish | ( | Clients * | pubclient, |
Publish * | publish, | ||
int | qos, | ||
int | retained, | ||
Messages ** | mm | ||
) |
Start a new publish exchange. Store any state necessary and try to send the packet
pubclient | the client to send the publication to |
publish | the publication data |
qos | the MQTT QoS to use |
retained | boolean - whether to set the MQTT retained flag |
mm | - pointer to the message to send |
Definition at line 162 of file MQTTProtocolClient.c.
Publications* MQTTProtocol_storePublication | ( | Publish * | publish, |
int * | len | ||
) |
Store message data for possible retry
publish | the publication data |
len | returned length of the data stored |
Definition at line 252 of file MQTTProtocolClient.c.
char* MQTTStrdup | ( | const char * | src | ) |
Duplicate a string, safely, allocating space on the heap
src | the source string which characters copy from |
Definition at line 925 of file MQTTProtocolClient.c.
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 by dest. The destination string will always be null-terminated.
dest | the array which characters copy to |
src | the source string which characters copy from |
dest_size | the size of the memory pointed to by dest: copy no more than this -1 (allow for null). Must be >= 1 |
Definition at line 900 of file MQTTProtocolClient.c.
Definition at line 3396 of file MQTTAsync.c.