MQTT-C
|
Developer documentation of the functions and datastructures used for deserializing MQTT control packets. More...
Data Structures | |
struct | mqtt_fixed_header |
The fixed header of an MQTT control packet. More... | |
struct | mqtt_response_connack |
A connection response datastructure. More... | |
struct | mqtt_response_publish |
A publish packet received from the broker.A publish packet is received from the broker when a client publishes to a topic that the {local client} is subscribed to. More... | |
struct | mqtt_response_puback |
A publish acknowledgement for messages that were published with QoS level 1. More... | |
struct | mqtt_response_pubrec |
The response packet to a PUBLISH packet with QoS level 2. More... | |
struct | mqtt_response_pubrel |
The response to a PUBREC packet. More... | |
struct | mqtt_response_pubcomp |
The response to a PUBREL packet. More... | |
struct | mqtt_response_suback |
The response to a subscription request. More... | |
struct | mqtt_response_unsuback |
The brokers response to a UNSUBSCRIBE request. More... | |
struct | mqtt_response_pingresp |
The response to a ping request. More... | |
struct | mqtt_response |
A struct used to deserialize/interpret an incoming packet from the broker. More... | |
Enumerations | |
enum | MQTTControlPacketType { MQTT_CONTROL_CONNECT =1u, MQTT_CONTROL_CONNACK =2u, MQTT_CONTROL_PUBLISH =3u, MQTT_CONTROL_PUBACK =4u, MQTT_CONTROL_PUBREC =5u, MQTT_CONTROL_PUBREL =6u, MQTT_CONTROL_PUBCOMP =7u, MQTT_CONTROL_SUBSCRIBE =8u, MQTT_CONTROL_SUBACK =9u, MQTT_CONTROL_UNSUBSCRIBE =10u, MQTT_CONTROL_UNSUBACK =11u, MQTT_CONTROL_PINGREQ =12u, MQTT_CONTROL_PINGRESP =13u, MQTT_CONTROL_DISCONNECT =14u } |
An enumeration of the MQTT control packet types. More... | |
enum | MQTTConnackReturnCode { MQTT_CONNACK_ACCEPTED = 0u, MQTT_CONNACK_REFUSED_PROTOCOL_VERSION = 1u, MQTT_CONNACK_REFUSED_IDENTIFIER_REJECTED = 2u, MQTT_CONNACK_REFUSED_SERVER_UNAVAILABLE = 3u, MQTT_CONNACK_REFUSED_BAD_USER_NAME_OR_PASSWORD = 4u, MQTT_CONNACK_REFUSED_NOT_AUTHORIZED = 5u } |
An enumeration of the return codes returned in a CONNACK packet. More... | |
enum | MQTTSubackReturnCodes { MQTT_SUBACK_SUCCESS_MAX_QOS_0 = 0u, MQTT_SUBACK_SUCCESS_MAX_QOS_1 = 1u, MQTT_SUBACK_SUCCESS_MAX_QOS_2 = 2u, MQTT_SUBACK_FAILURE = 128u } |
An enumeration of subscription acknowledgement return codes. More... | |
Functions | |
ssize_t | mqtt_unpack_fixed_header (struct mqtt_response *response, const uint8_t *buf, size_t bufsz) |
Deserialize the contents of buf into an mqtt_fixed_header object. More... | |
ssize_t | mqtt_unpack_connack_response (struct mqtt_response *mqtt_response, const uint8_t *buf) |
Deserialize a CONNACK response from buf . More... | |
ssize_t | mqtt_unpack_publish_response (struct mqtt_response *mqtt_response, const uint8_t *buf) |
Deserialize a publish response from buf . More... | |
ssize_t | mqtt_unpack_pubxxx_response (struct mqtt_response *mqtt_response, const uint8_t *buf) |
Deserialize a PUBACK/PUBREC/PUBREL/PUBCOMP packet from buf . More... | |
ssize_t | mqtt_unpack_response (struct mqtt_response *response, const uint8_t *buf, size_t bufsz) |
Deserialize a packet from the broker. More... | |
Developer documentation of the functions and datastructures used for deserializing MQTT control packets.
An enumeration of the return codes returned in a CONNACK packet.
An enumeration of the MQTT control packet types.
An enumeration of subscription acknowledgement return codes.
|
related |
Deserialize a CONNACK response from buf
.
MQTT_CONTROL_CONNACK
.[out] | mqtt_response | the mqtt_response that will be initialized. |
[in] | buf | the buffer that contains the variable header and payload of the packet. The first byte of buf should be the first byte of the variable header. |
ssize_t mqtt_unpack_fixed_header | ( | struct mqtt_response * | response, |
const uint8_t * | buf, | ||
size_t | bufsz | ||
) |
Deserialize the contents of buf
into an mqtt_fixed_header object.
buf
.[out] | response | the response who's mqtt_response::fixed_header will be initialized. |
[in] | buf | the buffer. |
[in] | bufsz | the total number of bytes in the buffer. |
|
related |
Deserialize a publish response from buf
.
MQTT_CONTROL_PUBLISH
.[out] | mqtt_response | the response that is initialized from the contents of buf . |
[in] | buf | the buffer with the incoming data. |
|
related |
Deserialize a PUBACK/PUBREC/PUBREL/PUBCOMP packet from buf
.
MQTT_CONTROL_PUBACK
, MQTT_CONTROL_PUBREC
, MQTT_CONTROL_PUBREL
or MQTT_CONTROL_PUBCOMP
.[out] | mqtt_response | the response that is initialized from the contents of buf . |
[in] | buf | the buffer with the incoming data. |
mqtt_response_pubrec mqtt_response_pubrel mqtt_response_pubcomp
|
related |
Deserialize a packet from the broker.
[out] | response | the mqtt_response that will be initialize from buf . |
[in] | buf | the incoming data buffer. |
[in] | bufsz | the number of bytes available in the buffer. |
buf
does not contain enough bytes to deserialize the packet, a negative value if a protocol violation was encountered.