Functions | |
int | MQTTDeserialize_connack (unsigned char *sessionPresent, unsigned char *connack_rc, unsigned char *buf, int buflen) |
Deserializes the supplied (wire) buffer into connack data - return code. More... | |
int | MQTTSerialize_connect (unsigned char *buf, int buflen, MQTTPacket_connectData *options) |
Serializes the connect options into the buffer. More... | |
int | MQTTSerialize_connectLength (MQTTPacket_connectData *options) |
Determines the length of the MQTT connect packet that would be produced using the supplied connect options. More... | |
int | MQTTSerialize_disconnect (unsigned char *buf, int buflen) |
Serializes a disconnect packet into the supplied buffer, ready for writing to a socket. More... | |
int | MQTTSerialize_pingreq (unsigned char *buf, int buflen) |
Serializes a disconnect packet into the supplied buffer, ready for writing to a socket. More... | |
int | MQTTSerialize_zero (unsigned char *buf, int buflen, unsigned char packettype) |
Serializes a 0-length packet into the supplied buffer, ready for writing to a socket. More... | |
int MQTTDeserialize_connack | ( | unsigned char * | sessionPresent, |
unsigned char * | connack_rc, | ||
unsigned char * | buf, | ||
int | 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 |
len | the length in bytes of the data in the supplied buffer |
References MQTTConnackFlags::all, MQTTHeader::bits, MQTTConnackFlags::bits, MQTTHeader::byte, CONNACK, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPacket_decodeBuf(), NULL, readChar(), MQTTConnackFlags::sessionpresent, and MQTTHeader::type.
Referenced by MQTTConnect(), and MQTTFormat_toClientString().
int MQTTSerialize_connect | ( | unsigned char * | buf, |
int | buflen, | ||
MQTTPacket_connectData * | options | ||
) |
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 |
References MQTTConnectFlags::all, MQTTConnectFlags::bits, MQTTHeader::bits, MQTTHeader::byte, MQTTConnectFlags::cleansession, MQTTPacket_connectData::cleansession, MQTTPacket_connectData::clientID, CONNECT, MQTTString::cstring, MQTTLenString::data, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPacket_connectData::keepAliveInterval, MQTTString::lenstring, MQTTPacket_willOptions::message, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), MQTTPacket_len(), MQTTSerialize_connectLength(), MQTTPacket_connectData::MQTTVersion, MQTTConnectFlags::password, MQTTPacket_connectData::password, ptr, MQTTPacket_willOptions::qos, MQTTPacket_willOptions::retained, MQTTPacket_willOptions::topicName, MQTTHeader::type, MQTTConnectFlags::username, MQTTPacket_connectData::username, MQTTConnectFlags::will, MQTTPacket_connectData::will, MQTTPacket_connectData::willFlag, MQTTConnectFlags::willQoS, MQTTConnectFlags::willRetain, writeChar(), writeCString(), writeInt(), and writeMQTTString().
Referenced by MQTTConnect().
int MQTTSerialize_connectLength | ( | 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 |
References MQTTPacket_connectData::clientID, MQTTString::cstring, MQTTLenString::data, FUNC_ENTRY, FUNC_EXIT_RC, 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().
int MQTTSerialize_disconnect | ( | unsigned char * | buf, |
int | buflen | ||
) |
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 |
References DISCONNECT, and MQTTSerialize_zero().
Referenced by MQTTDisconnect().
int MQTTSerialize_pingreq | ( | unsigned char * | buf, |
int | buflen | ||
) |
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 |
References MQTTSerialize_zero(), and PINGREQ.
Referenced by keepalive().
int MQTTSerialize_zero | ( | unsigned char * | buf, |
int | buflen, | ||
unsigned char | packettype | ||
) |
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 |
References MQTTHeader::bits, MQTTHeader::byte, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), ptr, MQTTHeader::type, and writeChar().
Referenced by MQTTSerialize_disconnect(), and MQTTSerialize_pingreq().