Microchip® Advanced Software Framework

pahomqtt/MQTTPacket/MQTTDeserializePublish.c File Reference
#include "StackTrace.h"
#include "MQTTPacket.h"
#include <string.h>

Macros

#define min(a, b)   ((a < b) ? 1 : 0)
 

Functions

int MQTTDeserialize_ack (unsigned char *packettype, unsigned char *dup, unsigned short *packetid, unsigned char *buf, int buflen)
 Deserializes the supplied (wire) buffer into an ack. More...
 
int MQTTDeserialize_publish (unsigned char *dup, int *qos, unsigned char *retained, unsigned short *packetid, MQTTString *topicName, unsigned char **payload, int *payloadlen, unsigned char *buf, int buflen)
 Deserializes the supplied (wire) buffer into publish data. More...
 

int MQTTDeserialize_ack ( unsigned char *  packettype,
unsigned char *  dup,
unsigned short *  packetid,
unsigned char *  buf,
int  buflen 
)

Deserializes the supplied (wire) buffer into an ack.

Parameters
packettypereturned integer - the MQTT packet type
dupreturned integer - the MQTT dup flag
packetidreturned integer - the MQTT packet identifier
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, 0 is failure

References MQTTHeader::bits, buf, MQTTHeader::byte, MQTTHeader::dup, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPacket_decodeBuf(), NULL, readChar(), readInt(), and MQTTHeader::type.

Referenced by cycle(), handlePubrec(), MQTTDeserialize_unsuback(), MQTTFormat_toClientString(), MQTTFormat_toServerString(), and MQTTPublish().

int MQTTDeserialize_publish ( unsigned char *  dup,
int *  qos,
unsigned char *  retained,
unsigned short *  packetid,
MQTTString topicName,
unsigned char **  payload,
int *  payloadlen,
unsigned char *  buf,
int  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, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPacket_decodeBuf(), NULL, PUBLISH, MQTTHeader::qos, readChar(), readInt(), readMQTTLenString(), MQTTHeader::retain, and MQTTHeader::type.

Referenced by cycle(), handlePublish(), MQTTFormat_toClientString(), and MQTTFormat_toServerString().