Microchip® Advanced Software Framework

AWS_SDK/AWS_SDK/aws_mqtt_embedded_client_lib/MQTTPacket/src/MQTTPublish.h File Reference
#include "MQTTMessage.h"

Macros

#define DLLExport
 
#define DLLImport
 

Functions

DLLExport MQTTReturnCode MQTTDeserialize_publish (unsigned char *dup, QoS *qos, unsigned char *retained, uint16_t *packetid, MQTTString *topicName, unsigned char **payload, uint32_t *payloadlen, unsigned char *buf, size_t buflen)
 Deserializes the supplied (wire) buffer into publish data. More...
 
DLLExport MQTTReturnCode MQTTSerialize_puback (unsigned char *buf, size_t buflen, uint16_t packetid, uint32_t *serialized_len)
 Serializes a puback packet into the supplied buffer. More...
 
DLLExport MQTTReturnCode MQTTSerialize_pubcomp (unsigned char *buf, size_t buflen, uint16_t packetid, uint32_t *serialized_len)
 Serializes a pubrel packet into the supplied buffer. More...
 
DLLExport MQTTReturnCode MQTTSerialize_publish (unsigned char *buf, size_t buflen, uint8_t dup, QoS qos, uint8_t retained, uint16_t packetid, MQTTString topicName, unsigned char *payload, size_t payloadlen, uint32_t *serialized_len)
 Serializes the supplied publish data into the supplied buffer, ready for sending. More...
 
DLLExport MQTTReturnCode MQTTSerialize_pubrel (unsigned char *buf, size_t buflen, unsigned char dup, uint16_t packetid, uint32_t *serialized_len)
 Serializes a pubrel packet into the supplied buffer. More...
 

#define DLLExport
#define DLLImport

DLLExport MQTTReturnCode MQTTDeserialize_publish ( unsigned char *  dup,
QoS qos,
unsigned char *  retained,
uint16_t *  packetid,
MQTTString topicName,
unsigned char **  payload,
uint32_t *  payloadlen,
unsigned char *  buf,
size_t  buflen 
)

Deserializes the supplied (wire) buffer into publish data.

Parameters
dupreturned integer - the MQTT dup flag
qosreturned integer - the MQTT QoS value
retainedreturned integer - the MQTT retained flag
packetidreturned integer - the MQTT packet identifier
topicNamereturned MQTTString - the MQTT topic in the publish
payloadreturned byte buffer - the MQTT publish payload
payloadlenreturned integer - the length of the MQTT payload
bufthe raw buffer data, of the correct length determined by the remaining length field
buflenthe length in bytes of the data in the supplied buffer
Returns
error code. 1 is success

References MQTTHeader::bits, buf, MQTTHeader::byte, MQTTHeader::dup, FAILURE, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_decodeBuf(), NULL, PUBLISH, MQTTHeader::qos, QOS0, readChar(), readMQTTLenString(), readPacketId(), MQTTHeader::retain, SUCCESS, and MQTTHeader::type.

DLLExport MQTTReturnCode MQTTSerialize_puback ( unsigned char *  buf,
size_t  buflen,
uint16_t  packetid,
uint32_t *  serialized_len 
)

Serializes a puback packet into the supplied buffer.

Parameters
bufthe buffer into which the packet will be serialized
buflenthe length in bytes of the supplied buffer
packetidinteger - the MQTT packet identifier
Returns
serialized length, or error if 0

References MQTTSerialize_ack(), and PUBACK.

DLLExport MQTTReturnCode MQTTSerialize_pubcomp ( unsigned char *  buf,
size_t  buflen,
uint16_t  packetid,
uint32_t *  serialized_len 
)

Serializes a pubrel packet into the supplied buffer.

Parameters
bufthe buffer into which the packet will be serialized
buflenthe length in bytes of the supplied buffer
packetidinteger - the MQTT packet identifier
Returns
serialized length, or error if 0

References MQTTSerialize_ack(), and PUBCOMP.

DLLExport MQTTReturnCode MQTTSerialize_publish ( unsigned char *  buf,
size_t  buflen,
uint8_t  dup,
QoS  qos,
uint8_t  retained,
uint16_t  packetid,
MQTTString  topicName,
unsigned char *  payload,
size_t  payloadlen,
uint32_t *  serialized_len 
)

Serializes the supplied publish data into the supplied buffer, ready for sending.

Parameters
bufthe buffer into which the packet will be serialized
buflenthe length in bytes of the supplied buffer
dupinteger - the MQTT dup flag
qosinteger - the MQTT QoS value
retainedinteger - the MQTT retained flag
packetidinteger - the MQTT packet identifier
topicNameMQTTString - the MQTT topic in the publish
payloadbyte buffer - the MQTT publish payload
payloadleninteger - the length of the MQTT payload
Returns
the length of the serialized data. <= 0 indicates error

References buf, MQTTHeader::byte, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTT_NULL_VALUE_ERROR, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), MQTTPacket_InitHeader(), MQTTPacket_len(), MQTTSerialize_GetPublishLength(), NULL, ptr, PUBLISH, SUCCESS, writeChar(), writeInt(), and writeMQTTString().

DLLExport MQTTReturnCode MQTTSerialize_pubrel ( unsigned char *  buf,
size_t  buflen,
unsigned char  dup,
uint16_t  packetid,
uint32_t *  serialized_len 
)

Serializes a pubrel packet into the supplied buffer.

Parameters
bufthe buffer into which the packet will be serialized
buflenthe length in bytes of the supplied buffer
dupinteger - the MQTT dup flag
packetidinteger - the MQTT packet identifier
Returns
serialized length, or error if 0

References MQTTSerialize_ack(), and PUBREL.