ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
mqtt.h File Reference

The MQTT Client (PROTOCORE_ENABLE_MQTT). More...

#include "protocore_config.h"

Go to the source code of this file.

Detailed Description

The MQTT Client (PROTOCORE_ENABLE_MQTT).

The governing document is "MQTT Version 3.1.1", an OASIS Standard dated 29 October 2014, amended by "MQTT Version 3.1.1 Plus Errata 01" (OASIS Standard Incorporating Approved Errata 01, 10 December 2015). MQTT is not an IETF protocol and carries no RFC number; every section cited below is a section of that OASIS document. The same text is published as ISO/IEC 20922:2016.

The Client and the Server exchange MQTT Control Packets over a Network Connection (sec 4.2). Each packet is a fixed header (sec 2.2) carrying the Control Packet type (sec 2.2.1), four type-specific flag bits (sec 2.2.2) and a Remaining Length (sec 2.2.3), then an optional variable header and payload.

Two halves behind one handle:

  • The codec builds and reads packet octets in the caller's buffers and holds nothing, so it is unit-tested on the host.
  • The transport drives one Network Connection over the outbound TCP client, and mqtts:// over the shared persistent client TLS session. No heap; one Server at a time.

QoS 2 runs the four-packet PUBLISH / PUBREC / PUBREL / PUBCOMP exchange (sec 4.3.3). Outbound QoS 1 and QoS 2 messages sit in a fixed in-flight pool and are re-delivered with DUP set (sec 3.3.1.1) until acknowledged. An inbound QoS 2 Packet Identifier is held from PUBREC until PUBCOMP so a repeat delivers the Application Message once (sec 4.3.3).

The module exports one symbol, Mqtt. Everything in mqtt.c has internal linkage.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file mqtt.h.