Microchip® Advanced Software Framework

MQTTUnsubscribeServer.c File Reference
#include "MQTTPacket.h"
#include "StackTrace.h"
#include <string.h>

Functions

int MQTTDeserialize_unsubscribe (unsigned char *dup, unsigned short *packetid, int maxcount, int *count, MQTTString topicFilters[], unsigned char *buf, int len)
 Deserializes the supplied (wire) buffer into unsubscribe data. More...
 
int MQTTSerialize_unsuback (unsigned char *buf, int buflen, unsigned short packetid)
 Serializes the supplied unsuback data into the supplied buffer, ready for sending. More...
 

int MQTTDeserialize_unsubscribe ( unsigned char *  dup,
unsigned short *  packetid,
int  maxcount,
int *  count,
MQTTString  topicFilters[],
unsigned char *  buf,
int  len 
)

Deserializes the supplied (wire) buffer into unsubscribe data.

Parameters
dupinteger returned - the MQTT dup flag
packetidinteger returned - the MQTT packet identifier
maxcount- the maximum number of members allowed in the topicFilters and requestedQoSs arrays
count- number of members in the topicFilters and requestedQoSs arrays
topicFilters- array of topic filter names
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
the length of the serialized data. <= 0 indicates error

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

Referenced by MQTTFormat_toServerString().

int MQTTSerialize_unsuback ( unsigned char *  buf,
int  buflen,
unsigned short  packetid 
)

Serializes the supplied unsuback 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
packetidinteger - the MQTT packet identifier
Returns
the length of the serialized data. <= 0 indicates error

References MQTTHeader::bits, MQTTHeader::byte, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), ptr, MQTTHeader::type, UNSUBACK, writeChar(), and writeInt().