|
MQTT-C
|
Developer documentation for the utilities used to implement the MQTT-C client. More...

Data Structures | |
| A message in a mqtt_message_queue. More... | |
| A message queue. More... | |
| struct | mqtt_client |
| An MQTT client. More... | |
Macros | |
| #define | mqtt_mq_get(mq_ptr, index) |
Returns the mqtt_queued_message at index. | |
| #define | mqtt_mq_length(mq_ptr) |
Returns the number of messages in the message queue, mq_ptr. | |
| #define | mqtt_mq_currsz(mq_ptr) |
Used internally to recalculate the curr_sz. | |
Enumerations | |
| enum | MQTTQueuedMessageState { MQTT_QUEUED_UNSENT , MQTT_QUEUED_AWAITING_ACK , MQTT_QUEUED_COMPLETE } |
| An enumeration of queued message states. | |
Functions | |
| uint16_t | __mqtt_next_pid (struct mqtt_client *client) |
| Generate a new next packet ID. | |
| ssize_t | __mqtt_send (struct mqtt_client *client) |
| Handles egress client traffic. | |
| ssize_t | __mqtt_recv (struct mqtt_client *client) |
| Handles ingress client traffic. | |
| ssize_t | __mqtt_puback (struct mqtt_client *client, uint16_t packet_id) |
| Acknowledge an ingree publish with QOS==1. | |
| ssize_t | __mqtt_pubrec (struct mqtt_client *client, uint16_t packet_id) |
| Acknowledge an ingree publish with QOS==2. | |
| ssize_t | __mqtt_pubrel (struct mqtt_client *client, uint16_t packet_id) |
| Acknowledge an ingree PUBREC packet. | |
| ssize_t | __mqtt_pubcomp (struct mqtt_client *client, uint16_t packet_id) |
| Acknowledge an ingree PUBREL packet. | |
| void | mqtt_mq_init (struct mqtt_message_queue *mq, void *buf, size_t bufsz) |
| Initialize a message queue. | |
| void | mqtt_mq_clean (struct mqtt_message_queue *mq) |
| Clear as many messages from the front of the queue as possible. | |
| struct mqtt_queued_message * | mqtt_mq_register (struct mqtt_message_queue *mq, size_t nbytes) |
| Register a message that was just added to the buffer. | |
| struct mqtt_queued_message * | mqtt_mq_find (const struct mqtt_message_queue *mq, enum MQTTControlPacketType control_type, const uint16_t *packet_id) |
| Find a message in the message queue. | |
Developer documentation for the utilities used to implement the MQTT-C client.
| #define mqtt_mq_currsz | ( | mq_ptr | ) |
Used internally to recalculate the curr_sz.
| #define mqtt_mq_get | ( | mq_ptr, | |
| index ) |
Returns the mqtt_queued_message at index.
| mq_ptr | A pointer to the message queue. |
| index | The index of the message. |
index. | #define mqtt_mq_length | ( | mq_ptr | ) |
Returns the number of messages in the message queue, mq_ptr.
| uint16_t __mqtt_next_pid | ( | struct mqtt_client * | client | ) |
Generate a new next packet ID.
Packet ID's are generated using a max-length LFSR.
| client | The MQTT client. |
| ssize_t __mqtt_puback | ( | struct mqtt_client * | client, |
| uint16_t | packet_id ) |
Acknowledge an ingree publish with QOS==1.
| [in,out] | client | The MQTT client. |
| [in] | packet_id | The packet ID of the ingress publish being acknowledged. |
MQTT_OK upon success, an MQTTErrors otherwise. | ssize_t __mqtt_pubcomp | ( | struct mqtt_client * | client, |
| uint16_t | packet_id ) |
Acknowledge an ingree PUBREL packet.
| [in,out] | client | The MQTT client. |
| [in] | packet_id | The packet ID of the ingress PUBREL being acknowledged. |
MQTT_OK upon success, an MQTTErrors otherwise. | ssize_t __mqtt_pubrec | ( | struct mqtt_client * | client, |
| uint16_t | packet_id ) |
Acknowledge an ingree publish with QOS==2.
| [in,out] | client | The MQTT client. |
| [in] | packet_id | The packet ID of the ingress publish being acknowledged. |
MQTT_OK upon success, an MQTTErrors otherwise. | ssize_t __mqtt_pubrel | ( | struct mqtt_client * | client, |
| uint16_t | packet_id ) |
Acknowledge an ingree PUBREC packet.
| [in,out] | client | The MQTT client. |
| [in] | packet_id | The packet ID of the ingress PUBREC being acknowledged. |
MQTT_OK upon success, an MQTTErrors otherwise. | ssize_t __mqtt_recv | ( | struct mqtt_client * | client | ) |
Handles ingress client traffic.
| client | The MQTT client. |
| ssize_t __mqtt_send | ( | struct mqtt_client * | client | ) |
Handles egress client traffic.
| client | The MQTT client. |
|
Clear as many messages from the front of the queue as possible.
| mq | The message queue. |
|
Find a message in the message queue.
| mq | The message queue. | |
| [in] | control_type | The control type of the message you want to find. |
| [in] | packet_id | The packet ID of the message you want to find. Set to NULL if you don't want to specify a packet ID. |
NULL if the message was not found.
|
Initialize a message queue.
| [out] | mq | The message queue to initialize. |
| [in] | buf | The buffer for this message queue. |
| [in] | bufsz | The number of bytes in the buffer. |
|
Register a message that was just added to the buffer.
| mq | The message queue. | |
| [in] | nbytes | The number of bytes that were just packed. |