class
MQTT::Header
- MQTT::Header
- BinData
- Reference
- Object
Overview
Performs binary encoding and decoding of the fixed header.
NOTE : the fixed header is byte identical in 3.1.1 and 5.0, so both protocol versions build their packets on this
Direct Known Subclasses
- MQTT::V3::Ack
- MQTT::V3::Connack
- MQTT::V3::Connect
- MQTT::V3::EmptyPacket
- MQTT::V3::Publish
- MQTT::V3::Suback
- MQTT::V3::Subscribe
- MQTT::V3::Unsubscribe
- MQTT::V5::Ack
- MQTT::V5::Connack
- MQTT::V5::Connect
- MQTT::V5::EmptyPacket
- MQTT::V5::Publish
- MQTT::V5::Reasoned
- MQTT::V5::Suback
- MQTT::V5::Subscribe
- MQTT::V5::Unsuback
- MQTT::V5::Unsubscribe
Defined in:
mqtt/header.crConstant Summary
-
AFTER_DESERIALIZE =
[] of Nil -
Performs binary encoding and decoding of the fixed header.
NOTE : the fixed header is byte identical in 3.1.1 and 5.0, so both protocol versions build their packets on this
-
BEFORE_SERIALIZE =
[] of Nil -
Performs binary encoding and decoding of the fixed header.
NOTE : the fixed header is byte identical in 3.1.1 and 5.0, so both protocol versions build their packets on this
-
ENDIAN =
["big"] -
Performs binary encoding and decoding of the fixed header.
NOTE : the fixed header is byte identical in 3.1.1 and 5.0, so both protocol versions build their packets on this
-
KLASS_NAME =
[MQTT::Header] -
Performs binary encoding and decoding of the fixed header.
NOTE : the fixed header is byte identical in 3.1.1 and 5.0, so both protocol versions build their packets on this
-
PARTS =
[{type: "bitfield", name: 0, cls: MQTT::Header, onlyif: nil, verify: nil, endian: IO::ByteFormat::BigEndian}, {type: "basic", name: variable_length1, cls: UInt8, onlyif: nil, verify: nil, value: nil, endian: nil}, {type: "basic", name: variable_length2, cls: UInt8, onlyif: -> do (variable_length1 & 128) > 0 end, verify: nil, value: nil, endian: nil}, {type: "basic", name: variable_length3, cls: UInt8, onlyif: -> do (variable_length2 & 128) > 0 end, verify: nil, value: nil, endian: nil}, {type: "basic", name: variable_length4, cls: UInt8, onlyif: -> do (variable_length3 & 128) > 0 end, verify: nil, value: nil, endian: nil}] of Nil -
Performs binary encoding and decoding of the fixed header.
NOTE : the fixed header is byte identical in 3.1.1 and 5.0, so both protocol versions build their packets on this
-
REMAINING =
[] of Nil -
Performs binary encoding and decoding of the fixed header.
NOTE : the fixed header is byte identical in 3.1.1 and 5.0, so both protocol versions build their packets on this
-
UNCACHED =
4294967295_u32 -
invalid packet size to indicate if cached
Class Method Summary
-
.bit_fields
Performs binary encoding and decoding of the fixed header.
Instance Method Summary
-
#__format__ : IO::ByteFormat
A
grouporbit_fieldcaptures the endianness at its declaration point, so declaringendianafter one would silently leave it system-endian. - #duplicate : Bool
- #duplicate=(duplicate : UInt8)
- #duplicate=(value : Bool)
-
#fixed_header_size : Int32
Number of bytes the fixed header occupies on the wire.
- #id : MQTT::RequestType
- #id=(id : UInt8)
- #id=(value : MQTT::RequestType)
- #packet_length : UInt32
- #packet_length=(size : UInt32) : UInt32
- #qos : MQTT::QoS
- #qos=(qos : UInt8)
- #qos=(value : MQTT::QoS)
- #qos?
- #retain : Bool
- #retain=(retain : UInt8)
- #retain=(value : Bool)
- #variable_length1 : UInt8
- #variable_length1=(value : UInt8) : UInt8
- #variable_length2 : UInt8
- #variable_length2=(value : UInt8) : UInt8
- #variable_length3 : UInt8
- #variable_length3=(value : UInt8) : UInt8
- #variable_length4 : UInt8
- #variable_length4=(value : UInt8) : UInt8
Class Method Detail
Performs binary encoding and decoding of the fixed header.
NOTE : the fixed header is byte identical in 3.1.1 and 5.0, so both protocol versions build their packets on this
Instance Method Detail
A group or bit_field captures the endianness at its declaration point, so
declaring endian after one would silently leave it system-endian. Fail loudly.
Number of bytes the fixed header occupies on the wire. Avoids serialising the header just to measure it.
NOTE : this counts continuation bits rather than deriving the size from the decoded value. A remote host can send a non-minimal encoding, and the framing has to follow what is actually on the wire