Functions | |
MQTTReturnCode | MQTTDeserialize_connack (unsigned char *sessionPresent, MQTTReturnCode *connack_rc, unsigned char *buf, size_t buflen) |
Deserializes the supplied (wire) buffer into connack data - return code. More... | |
MQTTReturnCode | MQTTSerialize_connect (unsigned char *buf, size_t buflen, MQTTPacket_connectData *options, uint32_t *serialized_len) |
Serializes the connect options into the buffer. More... | |
MQTTReturnCode | MQTTSerialize_disconnect (unsigned char *buf, size_t buflen, uint32_t *serialized_length) |
Serializes a disconnect packet into the supplied buffer, ready for writing to a socket. More... | |
size_t | MQTTSerialize_GetConnectLength (MQTTPacket_connectData *options) |
Determines the length of the MQTT connect packet that would be produced using the supplied connect options. More... | |
MQTTReturnCode | MQTTSerialize_pingreq (unsigned char *buf, size_t buflen, uint32_t *serialized_length) |
Serializes a pingreq packet into the supplied buffer, ready for writing to a socket. More... | |
MQTTReturnCode | MQTTSerialize_zero (unsigned char *buf, size_t buflen, unsigned char packetType, uint32_t *serialized_length) |
Serializes a 0-length packet into the supplied buffer, ready for writing to a socket. More... | |
MQTTReturnCode MQTTDeserialize_connack | ( | unsigned char * | sessionPresent, |
MQTTReturnCode * | connack_rc, | ||
unsigned char * | buf, | ||
size_t | buflen | ||
) |
Deserializes the supplied (wire) buffer into connack data - return code.
sessionPresent | the session present flag returned (only for MQTT 3.1.1) |
connack_rc | returned integer value of the connack return code |
buf | the raw buffer data, of the correct length determined by the remaining length field |
buflen | the length in bytes of the data in the supplied buffer |
References MQTTConnackFlags::all, MQTTHeader::bits, MQTTConnackFlags::bits, buf, MQTTHeader::byte, CONANCK_UNACCEPTABLE_PROTOCOL_VERSION_ERROR, CONNACK, CONNACK_BAD_USERDATA_ERROR, CONNACK_CONNECTION_ACCEPTED, CONNACK_IDENTIFIER_REJECTED_ERROR, CONNACK_NOT_AUTHORIZED_ERROR, CONNACK_SERVER_UNAVAILABLE_ERROR, FAILURE, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTT_CONANCK_UNACCEPTABLE_PROTOCOL_VERSION_ERROR, MQTT_CONNACK_BAD_USERDATA_ERROR, MQTT_CONNACK_CONNECTION_ACCEPTED, MQTT_CONNACK_IDENTIFIER_REJECTED_ERROR, MQTT_CONNACK_NOT_AUTHORIZED_ERROR, MQTT_CONNACK_SERVER_UNAVAILABLE_ERROR, MQTT_CONNACK_UNKNOWN_ERROR, MQTT_NULL_VALUE_ERROR, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_decodeBuf(), NULL, readChar(), MQTTConnackFlags::sessionpresent, SUCCESS, and MQTTHeader::type.
MQTTReturnCode MQTTSerialize_connect | ( | unsigned char * | buf, |
size_t | buflen, | ||
MQTTPacket_connectData * | options, | ||
uint32_t * | serialized_len | ||
) |
Serializes the connect options into the buffer.
buf | the buffer into which the packet will be serialized |
len | the length in bytes of the supplied buffer |
options | the options to be used to build the connect packet |
serialized | length |
References MQTTConnectFlags::all, MQTTConnectFlags::bits, buf, MQTTHeader::byte, MQTTConnectFlags::cleansession, MQTTPacket_connectData::cleansession, MQTTPacket_connectData::clientID, CONNECT, MQTTString::cstring, MQTTLenString::data, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPacket_connectData::keepAliveInterval, len, MQTTString::lenstring, MQTTPacket_willOptions::message, MQTT_NULL_VALUE_ERROR, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), MQTTPacket_InitHeader(), MQTTPacket_len(), MQTTSerialize_GetConnectLength(), MQTTPacket_connectData::MQTTVersion, NULL, MQTTConnectFlags::password, MQTTPacket_connectData::password, ptr, MQTTPacket_willOptions::qos, QOS0, MQTTPacket_willOptions::retained, SUCCESS, MQTTPacket_willOptions::topicName, MQTTConnectFlags::username, MQTTPacket_connectData::username, MQTTConnectFlags::will, MQTTPacket_connectData::will, MQTTPacket_connectData::willFlag, MQTTConnectFlags::willQoS, MQTTConnectFlags::willRetain, writeChar(), writeCString(), writeInt(), and writeMQTTString().
MQTTReturnCode MQTTSerialize_disconnect | ( | unsigned char * | buf, |
size_t | buflen, | ||
uint32_t * | serialized_length | ||
) |
Serializes a disconnect packet into the supplied buffer, ready for writing to a socket.
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer, to avoid overruns |
serialized | length |
References DISCONNECT, and MQTTSerialize_zero().
size_t MQTTSerialize_GetConnectLength | ( | MQTTPacket_connectData * | options | ) |
Determines the length of the MQTT connect packet that would be produced using the supplied connect options.
options | the options to be used to build the connect packet |
the | length of buffer needed to contain the serialized version of the packet |
References MQTTPacket_connectData::clientID, MQTTString::cstring, MQTTLenString::data, FUNC_ENTRY, FUNC_EXIT_RC, len, MQTTString::lenstring, MQTTPacket_willOptions::message, MQTTstrlen(), MQTTPacket_connectData::MQTTVersion, MQTTPacket_connectData::password, MQTTPacket_willOptions::topicName, MQTTPacket_connectData::username, MQTTPacket_connectData::will, and MQTTPacket_connectData::willFlag.
Referenced by MQTTSerialize_connect().
MQTTReturnCode MQTTSerialize_pingreq | ( | unsigned char * | buf, |
size_t | buflen, | ||
uint32_t * | serialized_length | ||
) |
Serializes a pingreq packet into the supplied buffer, ready for writing to a socket.
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer, to avoid overruns |
serialized | length |
References MQTTSerialize_zero(), and PINGREQ.
MQTTReturnCode MQTTSerialize_zero | ( | unsigned char * | buf, |
size_t | buflen, | ||
unsigned char | packetType, | ||
uint32_t * | serialized_length | ||
) |
Serializes a 0-length packet into the supplied buffer, ready for writing to a socket.
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer, to avoid overruns |
packettype | the message type |
serialized | length |
References buf, MQTTHeader::byte, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTT_NULL_VALUE_ERROR, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), MQTTPacket_InitHeader(), NULL, ptr, QOS0, SUCCESS, and writeChar().