mqtt.c File Reference
`#include "lwip/apps/mqtt.h"`
`#include "lwip/apps/mqtt_priv.h"`
`#include "lwip/timeouts.h"`
`#include "lwip/ip_addr.h"`
`#include "lwip/mem.h"`
`#include "lwip/err.h"`
`#include "lwip/pbuf.h"`
`#include "lwip/altcp.h"`
`#include "lwip/altcp_tcp.h"`
`#include "lwip/altcp_tls.h"`
`#include <string.h>`

## Macros

#define | MQTT_DEBUG LWIP_DBG_OFF
#define | MQTT_CTL_PACKET_TYPE(fixed_hdr_byte0) ((fixed_hdr_byte0 & 0xf0) >> 4)
#define | mqtt_ringbuf_free(rb) (MQTT_OUTPUT_RINGBUF_SIZE - mqtt_ringbuf_len(rb))
#define | mqtt_ringbuf_linear_read_length(rb) LWIP_MIN(mqtt_ringbuf_len(rb), (MQTT_OUTPUT_RINGBUF_SIZE - (rb)->get))

## Enumerations

enum | { , MQTT_DATA_FLAG_LAST = 1 }
enum | mqtt_message_type
enum | mqtt_connect_flag

## Functions

err_t | mqtt_publish (mqtt_client_t *client, const char *topic, const void *payload, u16_t payload_length, u8_t qos, u8_t retain, mqtt_request_cb_t cb, void *arg)
err_t | mqtt_sub_unsub (mqtt_client_t *client, const char *topic, u8_t qos, mqtt_request_cb_t cb, void *arg, u8_t sub)
void | mqtt_set_inpub_callback (mqtt_client_t *client, mqtt_incoming_publish_cb_t pub_cb, mqtt_incoming_data_cb_t data_cb, void *arg)
mqtt_client_t * | mqtt_client_new (void)
void | mqtt_client_free (mqtt_client_t *client)
err_t | mqtt_client_connect (mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port, mqtt_connection_cb_t cb, void *arg, const struct mqtt_connect_client_info_t *client_info)
void | mqtt_disconnect (mqtt_client_t *client)
u8_t | mqtt_client_is_connected (mqtt_client_t *client)

## Detailed Description

MQTT client

## Macro Definition Documentation

## MQTT_CTL_PACKET_TYPE

#define MQTT_CTL_PACKET_TYPE | ( |  | fixed_hdr_byte0 | ) | ((fixed_hdr_byte0 & 0xf0) >> 4)

Helpers to extract control packet type and qos from first byte in fixed header

## MQTT_DEBUG

#define MQTT_DEBUG LWIP_DBG_OFF

MQTT_DEBUG: Default is off.

## mqtt_ringbuf_free

#define mqtt_ringbuf_free | ( |  | rb | ) | (MQTT_OUTPUT_RINGBUF_SIZE - mqtt_ringbuf_len(rb))

Return number of bytes free in ring buffer

## mqtt_ringbuf_linear_read_length

#define mqtt_ringbuf_linear_read_length | ( |  | rb | ) | LWIP_MIN(mqtt_ringbuf_len(rb), (MQTT_OUTPUT_RINGBUF_SIZE - (rb)->get))

Return number of bytes possible to read without wrapping around

## Enumeration Type Documentation

## anonymous enum

anonymous enum

MQTT client connection states

Enumerator
MQTT_DATA_FLAG_LAST | Flag set when last fragment of data arrives in data callback

## mqtt_connect_flag

enum mqtt_connect_flag

MQTT connect flags, only used in CONNECT message

## mqtt_message_type

enum mqtt_message_type

MQTT control message types