Coverage for src / zmqtt / _internal / packets / types.py: 100%
22 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-11-12 08:49 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-11-12 08:49 +0000
1from dataclasses import dataclass
2from enum import IntEnum
3from typing import ClassVar
6class PacketType(IntEnum):
7 CONNECT = 1
8 CONNACK = 2
9 PUBLISH = 3
10 PUBACK = 4
11 PUBREC = 5
12 PUBREL = 6
13 PUBCOMP = 7
14 SUBSCRIBE = 8
15 SUBACK = 9
16 UNSUBSCRIBE = 10
17 UNSUBACK = 11
18 PINGREQ = 12
19 PINGRESP = 13
20 DISCONNECT = 14
21 AUTH = 15 # MQTT 5.0 only
24@dataclass(frozen=True, slots=True, kw_only=True)
25class FixedHeader:
26 packet_type: PacketType
27 flags: int # lower 4 bits of first byte
28 remaining_length: int
31class Packet:
32 """Concrete subclasses must declare: packet_type: ClassVar[PacketType]."""
34 packet_type: ClassVar[PacketType]