class TLV::Header

Defined in:

tlv/header.cr

Constant 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

Class Method Summary

Macro Summary

Instance Method Summary

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


[View source]

Class Method Detail

def self.bit_fields #

[View source]

Macro Detail

macro tlv_header(name, onlyif = nil, verify = nil, value = nil) #

[View source]

Instance Method Detail

def __format__ : IO::ByteFormat #

[View source]
def anonymous? : Bool #

[View source]
def common : TLV::Header::Common #

Common Profile - 2 bytes profile + 2 bytes tag


def common=(common : TLV::Header::Common) #

Common Profile - 2 bytes profile + 2 bytes tag


def container? : Bool #

[View source]
def context : TLV::Header::Context #

def context=(context : TLV::Header::Context) #

def element_type : ElementType #

[View source]
def element_type=(type : ElementType) #

[View source]
def element_type_raw : UInt8 #

control byte


def element_type_raw=(element_type_raw : UInt8) #

control byte


def end_of_container? : Bool #

[View source]

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}

[View source]
def tag=(tag : Nil) #

Sets the tag based on various formats


[View source]
def tag=(tag : UInt8) #

[View source]
def tag=(tag : Tuple(UInt16, UInt16)) #

[View source]
def tag=(tag : Tuple(UInt16, UInt16, UInt16)) #

[View source]
def tag_format : UInt8 #

control byte


def tag_format=(tag_format : UInt8) #

control byte


def tag_type : TagType #

[View source]
def tag_type=(type : TagType) #

[View source]
def vendor : TLV::Header::Vendor #

Vendor Profile - 2 bytes vendor + 2 bytes profile + 2 bytes tag


def vendor=(vendor : TLV::Header::Vendor) #

Vendor Profile - 2 bytes vendor + 2 bytes profile + 2 bytes tag