Expand description
MQTT (Message Queuing Telemetry Transport) layer implementation.
Implements MQTT v3.1, v3.1.1, and v5.0 packet parsing as a zero-copy view into a packet buffer.
§Fixed Header Format
Byte 0: [msg_type(4 bits)] [dup(1)] [qos(2)] [retain(1)]
Byte 1+: Remaining Length (variable-length encoded, 1-4 bytes)§Message Types
| Value | Name | Direction |
|---|---|---|
| 1 | CONNECT | Client -> Server |
| 2 | CONNACK | Server -> Client |
| 3 | PUBLISH | Both |
| 4 | PUBACK | Both |
| 5 | PUBREC | Both |
| 6 | PUBREL | Both |
| 7 | PUBCOMP | Both |
| 8 | SUBSCRIBE | Client -> Server |
| 9 | SUBACK | Server -> Client |
| 10 | UNSUBSCRIBE | Client -> Server |
| 11 | UNSUBACK | Server -> Client |
| 12 | PINGREQ | Client -> Server |
| 13 | PINGRESP | Server -> Client |
| 14 | DISCONNECT | Both (v5.0) |
| 15 | AUTH | Both (v5.0) |
Re-exports§
pub use builder::MqttBuilder;
Modules§
- builder
- MQTT packet builder.
Structs§
- Mqtt
Layer - MQTT layer – a zero-copy view into a packet buffer.
Constants§
- AUTH
- CONNACK
- CONNECT
- DISCONNECT
- MQTT_
MIN_ HEADER_ LEN - Minimum MQTT header: 1 byte fixed header + at least 1 byte remaining length.
- MQTT_
PORT - Default MQTT TCP port.
- PINGREQ
- PINGRESP
- PUBACK
- PUBCOMP
- PUBLISH
- PUBREC
- PUBREL
- SUBACK
- SUBSCRIBE
- UNSUBACK
- UNSUBSCRIBE
Statics§
- MQTT_
FIELD_ NAMES - Field names exported for Python/generic access.
Functions§
- decode_
variable_ length - Decode a variable-length integer from
bufstarting atoffset. - encode_
variable_ length - Encode a value as an MQTT variable-length integer.
- is_
mqtt_ payload - Check whether a TCP payload looks like an MQTT packet.
- message_
type_ name - Return the string name for an MQTT message type value.