mattertlv

package
v0.0.0-...-5413b3e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2023 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const TYPE_UINT_1 = 4
View Source
const TYPE_UINT_2 = 5
View Source
const TYPE_UINT_4 = 6
View Source
const TYPE_UINT_8 = 7

Variables

This section is empty.

Functions

This section is empty.

Types

type ElementType

type ElementType int
const TypeBool ElementType = 2
const TypeInt ElementType = 1
const TypeList ElementType = 5
const TypeNull ElementType = 6
const TypeOctetString ElementType = 4
const TypeUTF8String ElementType = 3

type TLVBuffer

type TLVBuffer struct {
	// contains filtered or unexported fields
}

TLVBuffer is buffer used to serialize matter TLV into bytes.

func (*TLVBuffer) Bytes

func (b *TLVBuffer) Bytes() []byte

func (*TLVBuffer) WriteAnonList

func (b *TLVBuffer) WriteAnonList()

WriteAnonList encodes start of list without tag

func (*TLVBuffer) WriteAnonStruct

func (b *TLVBuffer) WriteAnonStruct()

WriteAnonStruct encodes start of structure without tag

func (*TLVBuffer) WriteArray

func (b *TLVBuffer) WriteArray(tag byte)

WriteArray encodes start of array with specified tag

func (*TLVBuffer) WriteBool

func (b *TLVBuffer) WriteBool(tag byte, val bool)

func (*TLVBuffer) WriteList

func (b *TLVBuffer) WriteList(tag byte)

WriteList encodes start of list with specified tag

func (*TLVBuffer) WriteOctetString

func (b *TLVBuffer) WriteOctetString(tag byte, data []byte)

func (*TLVBuffer) WriteRaw

func (b *TLVBuffer) WriteRaw(raw []byte)

func (*TLVBuffer) WriteStruct

func (b *TLVBuffer) WriteStruct(tag byte)

WriteAnonList encodes start of structure with specified tag

func (*TLVBuffer) WriteStructEnd

func (b *TLVBuffer) WriteStructEnd()

WriteList encodes end of structure. This is used to terminate also list and array.

func (*TLVBuffer) WriteUInt

func (b *TLVBuffer) WriteUInt(tag byte, typ int, val uint64)

func (*TLVBuffer) WriteUInt16

func (b *TLVBuffer) WriteUInt16(tag byte, val uint16)

func (*TLVBuffer) WriteUInt32

func (b *TLVBuffer) WriteUInt32(tag byte, val uint32)

func (*TLVBuffer) WriteUInt64

func (b *TLVBuffer) WriteUInt64(tag byte, val uint64)

func (*TLVBuffer) WriteUInt8

func (b *TLVBuffer) WriteUInt8(tag byte, val byte)

type TlvItem

type TlvItem struct {
	Tag  int
	Type ElementType
	// contains filtered or unexported fields
}

TlvItem represents one TLV entry.

func Decode

func Decode(in []byte) TlvItem

Decode decodes binary TLV into structure represented by TlvItem.

func (TlvItem) Dump

func (i TlvItem) Dump(pad int)

func (TlvItem) DumpToString

func (i TlvItem) DumpToString(buf *strings.Builder, pad int)

func (TlvItem) DumpWithDict

func (i TlvItem) DumpWithDict(pad int, path string, dictionary map[string]string)

func (TlvItem) GetBool

func (i TlvItem) GetBool() bool

func (TlvItem) GetChild

func (i TlvItem) GetChild() []TlvItem

GetChild returns slice of all child entries.

func (TlvItem) GetInt

func (i TlvItem) GetInt() int

GetChild returns value of integer entry as int.

func (TlvItem) GetIntRec

func (i TlvItem) GetIntRec(tag []int) (uint64, error)

func (TlvItem) GetItemRec

func (i TlvItem) GetItemRec(tag []int) *TlvItem

func (TlvItem) GetItemWithTag

func (i TlvItem) GetItemWithTag(tag int) *TlvItem

func (TlvItem) GetOctetString

func (i TlvItem) GetOctetString() []byte

func (TlvItem) GetOctetStringRec

func (i TlvItem) GetOctetStringRec(tag []int) []byte

func (TlvItem) GetString

func (i TlvItem) GetString() string

func (TlvItem) GetUint64

func (i TlvItem) GetUint64() uint64

GetChild returns value of integer entry as uint64.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL