class
MQTT::V5::Properties
- MQTT::V5::Properties
- BinData
- Reference
- Object
Overview
The property section carried by nearly every 5.0 packet: a variable byte integer length, then properties until that many bytes are consumed
Defined in:
mqtt/v5/property.crConstant Summary
-
AFTER_DESERIALIZE =
[] of Nil -
The property section carried by nearly every 5.0 packet: a variable byte integer length, then properties until that many bytes are consumed
-
BEFORE_SERIALIZE =
[] of Nil -
The property section carried by nearly every 5.0 packet: a variable byte integer length, then properties until that many bytes are consumed
-
ENDIAN =
["big"] -
The property section carried by nearly every 5.0 packet: a variable byte integer length, then properties until that many bytes are consumed
-
KLASS_NAME =
[MQTT::V5::Properties] -
The property section carried by nearly every 5.0 packet: a variable byte integer length, then properties until that many bytes are consumed
-
PARTS =
[{type: "basic", name: len1, cls: UInt8, onlyif: nil, verify: nil, value: -> do encoded_length[0] end, endian: nil}, {type: "basic", name: len2, cls: UInt8, onlyif: -> do (len1 & 128) > 0 end, verify: nil, value: -> do encoded_length[1] end, endian: nil}, {type: "basic", name: len3, cls: UInt8, onlyif: -> do (len2 & 128) > 0 end, verify: nil, value: -> do encoded_length[2] end, endian: nil}, {type: "basic", name: len4, cls: UInt8, onlyif: -> do (len3 & 128) > 0 end, verify: nil, value: -> do encoded_length[3] end, endian: nil}, {type: "variable_array", name: properties, cls: MQTT::V5::Property, container: Array(MQTT::V5::Property), onlyif: nil, verify: nil, read_next: -> do (properties.sum(0, &.bytesize)) < declared_length end, value: nil}] of Nil -
The property section carried by nearly every 5.0 packet: a variable byte integer length, then properties until that many bytes are consumed
-
REMAINING =
[] of Nil -
The property section carried by nearly every 5.0 packet: a variable byte integer length, then properties until that many bytes are consumed
Class Method Summary
-
.bit_fields
The property section carried by nearly every 5.0 packet: a variable byte integer length, then properties until that many bytes are consumed
Instance Method Summary
-
#__format__ : IO::ByteFormat
A
grouporbit_fieldcaptures the endianness at its declaration point, so declaringendianafter one would silently leave it system-endian. -
#add_pair(id : PropertyId, key : String, value : String) : Nil
Repeatable, so these append rather than replace
- #add_variable_byte(id : PropertyId, value : UInt32) : Nil
- #all(id : PropertyId) : Array(Property)
- #binary(id : PropertyId) : Bytes | Nil
- #byte(id : PropertyId) : UInt8 | Nil
-
#content_length : Int32
Length the properties we hold actually occupy
-
#declared_length : Int32
Length the wire said the section would be
- #delete(id : PropertyId) : Nil
- #empty? : Bool
- #find(id : PropertyId) : Property | Nil
- #four_byte(id : PropertyId) : UInt32 | Nil
- #len1 : UInt8
- #len1=(len1 : UInt8)
- #len2 : UInt8
- #len2=(len2 : UInt8)
- #len3 : UInt8
- #len3=(len3 : UInt8)
- #len4 : UInt8
- #len4=(len4 : UInt8)
- #pairs(id : PropertyId) : Array(Tuple(String, String))
- #properties : Array(MQTT::V5::Property)
- #properties=(properties : Array(MQTT::V5::Property))
- #set_binary(id : PropertyId, value : Slice(UInt8) | Nil) : Nil
- #set_byte(id : PropertyId, value : UInt8 | Nil) : Nil
- #set_four_byte(id : PropertyId, value : UInt32 | Nil) : Nil
- #set_string(id : PropertyId, value : String | Nil) : Nil
- #set_two_byte(id : PropertyId, value : UInt16 | Nil) : Nil
- #set_variable_byte(id : PropertyId, value : UInt32 | Nil) : Nil
- #string(id : PropertyId) : String | Nil
-
#total_size : Int32
Total size on the wire, including the length prefix
- #two_byte(id : PropertyId) : UInt16 | Nil
-
#validate!(allowed : Enumerable(PropertyId), packet : String) : self
Checks the section against the properties legal for a given packet.
- #variable_byte(id : PropertyId) : UInt32 | Nil
- #variable_bytes(id : PropertyId) : Array(UInt32)
Class Method Detail
The property section carried by nearly every 5.0 packet: a variable byte integer length, then properties until that many bytes are consumed
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.
Repeatable, so these append rather than replace
Checks the section against the properties legal for a given packet. A property that may only appear once, appearing twice, is a protocol error rather than something to silently take the last of