MQTT-C: mqtt_message_queue Struct Reference

MQTT-C

Data Fields | Related Functions
mqtt_message_queue Struct Reference
Utilities

A message queue. More...

`#include <mqtt.h>`

## Data Fields
void * | mem_start
| The start of the message queue's memory block. More...
void * | mem_end
| The end of the message queue's memory block.
uint8_t * | curr
| A pointer to the position in the buffer you can pack bytes at. More...
size_t | curr_sz
| The number of bytes that can be written to `curr`. More...
struct mqtt_queued_message * | queue_tail
| The tail of the array of mqtt_queued_messages's. More...

## Related Functions
(Note that these are not member functions.)
void | mqtt_mq_init (struct mqtt_message_queue *mq, void *buf, size_t bufsz)
| Initialize a message queue. More...
void | mqtt_mq_clean (struct mqtt_message_queue *mq)
| Clear as many messages from the front of the queue as possible. More...
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. More...
struct mqtt_queued_message * | mqtt_mq_find (struct mqtt_message_queue *mq, enum MQTTControlPacketType control_type, uint16_t *packet_id)
| Find a message in the message queue. More...

## Detailed Description

A message queue.

Note
  This struct is used internally to manage sending messages.
  The only members the user should use are `curr` and `curr_sz`.

## Field Documentation

## ◆ curr

uint8_t* mqtt_message_queue::curr

A pointer to the position in the buffer you can pack bytes at.

Note
  Immediately after packing bytes at `curr` you must call mqtt_mq_register.

## ◆ curr_sz

size_t mqtt_message_queue::curr_sz

The number of bytes that can be written to `curr`.

Note
  curr_sz will decrease by more than the number of bytes you write to `curr`. This is because the mqtt_queued_message structs share the same memory (and thus, a mqtt_queued_message must be allocated in the message queue's memory whenever a new message is registered).

## ◆ mem_start

void* mqtt_message_queue::mem_start

The start of the message queue's memory block.

Warning
  This member should not be manually changed.

## ◆ queue_tail

struct mqtt_queued_message* mqtt_message_queue::queue_tail

The tail of the array of mqtt_queued_messages's.

Note
  This member should not be used manually.

The documentation for this struct was generated from the following file:

- include/mqtt.h