Microchip® Advanced Software Framework

AWS_SDK/AWS_SDK/aws_mqtt_embedded_client_lib/MQTTPacket/src/MQTTUnsubscribeClient.c File Reference
#include "MQTTPacket.h"
#include "StackTrace.h"
#include <string.h>

Functions

MQTTReturnCode MQTTDeserialize_unsuback (uint16_t *packetid, unsigned char *buf, size_t buflen)
 Deserializes the supplied (wire) buffer into unsuback data. More...
 
size_t MQTTSerialize_GetUnsubscribePacketLength (uint32_t count, MQTTString topicFilters[])
 Determines the length of the MQTT unsubscribe packet that would be produced using the supplied parameters. More...
 
MQTTReturnCode MQTTSerialize_unsubscribe (unsigned char *buf, size_t buflen, uint8_t dup, uint16_t packetid, uint32_t count, MQTTString topicFilters[], uint32_t *serialized_len)
 Serializes the supplied unsubscribe data into the supplied buffer, ready for sending. More...
 

MQTTReturnCode MQTTDeserialize_unsuback ( uint16_t *  packetid,
unsigned char *  buf,
size_t  buflen 
)

Deserializes the supplied (wire) buffer into unsuback data.

Parameters
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
MQTTReturnCode indicating function execution status

References FAILURE, FUNC_ENTRY, FUNC_EXIT_RC, MQTT_NULL_VALUE_ERROR, MQTTDeserialize_ack(), NULL, SUCCESS, and UNSUBACK.

size_t MQTTSerialize_GetUnsubscribePacketLength ( uint32_t  count,
MQTTString  topicFilters[] 
)

Determines the length of the MQTT unsubscribe packet that would be produced using the supplied parameters.

Parameters
countthe number of topic filter strings in topicFilters
topicFiltersthe array of topic filter strings to be used in the publish
Returns
the length of buffer needed to contain the serialized version of the packet

References count, i, len, and MQTTstrlen().

Referenced by MQTTSerialize_unsubscribe().

MQTTReturnCode MQTTSerialize_unsubscribe ( unsigned char *  buf,
size_t  buflen,
uint8_t  dup,
uint16_t  packetid,
uint32_t  count,
MQTTString  topicFilters[],
uint32_t *  serialized_len 
)

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

Parameters
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
dupinteger - the MQTT dup flag
packetidinteger - the MQTT packet identifier
count- number of members in the topicFilters array
topicFilters- array of topic filter names
serialized_len- the length of the serialized data
Returns
MQTTReturnCode indicating function execution status

References buf, MQTTHeader::byte, count, FUNC_ENTRY, FUNC_EXIT_RC, header, i, MQTT_NULL_VALUE_ERROR, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), MQTTPacket_InitHeader(), MQTTPacket_len(), MQTTSerialize_GetUnsubscribePacketLength(), NULL, ptr, SUCCESS, UNSUBSCRIBE, writeChar(), writeMQTTString(), and writePacketId().