class
TLV::Header
- TLV::Header
- BinData
- Reference
- Object
Defined in:
tlv/header.crConstant Summary
-
AFTER_DESERIALIZE =
[] of Nil -
BEFORE_SERIALIZE =
[] of Nil -
ENDIAN =
["little"] -
KLASS_NAME =
[TLV::Header] -
PARTS =
[{type: "bitfield", name: 0, cls: TLV::Header, onlyif: nil, verify: nil}, {type: "group", name: context, cls: Context, onlyif: -> do tag_format == TagType::Context.value end, verify: nil, value: nil}, {type: "group", name: common, cls: Common, onlyif: -> do tag_format == TagType::CommonProfile.value end, verify: nil, value: nil}, {type: "group", name: vendor, cls: Vendor, onlyif: -> do tag_format >= TagType::VendorProfile.value end, verify: nil, value: nil}] of Nil -
REMAINING =
[] of Nil
Constructors
-
.new(element_type : ElementType, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil)
Creates a header with the given element type and tag
Class Method Summary
Macro Summary
Instance Method Summary
- #__format__ : IO::ByteFormat
- #anonymous? : Bool
-
#common : TLV::Header::Common
Common Profile - 2 bytes profile + 2 bytes tag
-
#common=(common : TLV::Header::Common)
Common Profile - 2 bytes profile + 2 bytes tag
- #container? : Bool
- #context : TLV::Header::Context
- #context=(context : TLV::Header::Context)
- #element_type : ElementType
- #element_type=(type : ElementType)
-
#element_type_raw : UInt8
control byte
-
#element_type_raw=(element_type_raw : UInt8)
control byte
- #end_of_container? : Bool
-
#ids : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16)
Returns the tag identifier(s) based on tag type - Anonymous: nil - Context: UInt8 tag id - Common Profile: {profile_id, tag_id} - Vendor Profile: {vendor_id, profile_id, tag_id}
-
#tag=(tag : Nil)
Sets the tag based on various formats
- #tag=(tag : UInt8)
- #tag=(tag : Tuple(UInt16, UInt16))
- #tag=(tag : Tuple(UInt16, UInt16, UInt16))
-
#tag_format : UInt8
control byte
-
#tag_format=(tag_format : UInt8)
control byte
- #tag_type : TagType
- #tag_type=(type : TagType)
-
#vendor : TLV::Header::Vendor
Vendor Profile - 2 bytes vendor + 2 bytes profile + 2 bytes tag
-
#vendor=(vendor : TLV::Header::Vendor)
Vendor Profile - 2 bytes vendor + 2 bytes profile + 2 bytes tag
Constructor Detail
def self.new(element_type : ElementType, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil)
#
Creates a header with the given element type and tag
Class Method Detail
Macro Detail
Instance Method Detail
Returns the tag identifier(s) based on tag type
- Anonymous: nil
- Context: UInt8 tag id
- Common Profile: {profile_id, tag_id}
- Vendor Profile: {vendor_id, profile_id, tag_id}
def vendor=(vendor : TLV::Header::Vendor)
#
Vendor Profile - 2 bytes vendor + 2 bytes profile + 2 bytes tag