Documentation ¶
Index ¶
- Constants
- Variables
- func EstimateStructOverhead(firstFieldSize int, args ...int) int
- type Decoder
- func (dec *Decoder) EnterContainer() (Type, error)
- func (dec *Decoder) ExitContainer(outerContainerType Type) error
- func (dec *Decoder) Get(out any) error
- func (dec *Decoder) GetBoolean() (bool, error)
- func (dec *Decoder) GetBytes() (data []byte, err error)
- func (dec *Decoder) GetF32() (f32 float32, err error)
- func (dec *Decoder) GetF64() (f64 float64, err error)
- func (dec *Decoder) GetI16() (i16 int16, err error)
- func (dec *Decoder) GetI32() (i32 int32, err error)
- func (dec *Decoder) GetI8() (i8 int8, err error)
- func (dec *Decoder) GetInt() (int64, error)
- func (dec *Decoder) GetTag() Tag
- func (dec *Decoder) GetU16() (uint16, error)
- func (dec *Decoder) GetU32() (uint32, error)
- func (dec *Decoder) GetU8() (uint8, error)
- func (dec *Decoder) GetUint() (uint64, error)
- func (dec *Decoder) Next() error
- func (dec *Decoder) NextTag(tag Tag) error
- func (dec *Decoder) NextType(expectedType Type, expectedTag Tag) error
- func (dec *Decoder) NextValue(tag Tag, out any) error
- func (dec *Decoder) TagError(val any) error
- type Encoder
- func (enc *Encoder) EndContainer(outerContainerType Type) error
- func (enc *Encoder) Put(tag Tag, v any) error
- func (enc *Encoder) PutBoolean(tag Tag, b bool) error
- func (enc *Encoder) PutBytes(tag Tag, data []byte) error
- func (enc *Encoder) PutF32(tag Tag, f32 float32) error
- func (enc *Encoder) PutF64(tag Tag, f64 float64) error
- func (enc *Encoder) PutI16(tag Tag, val int16) error
- func (enc *Encoder) PutI32(tag Tag, val int32) error
- func (enc *Encoder) PutI64(tag Tag, val int64) error
- func (enc *Encoder) PutI8(tag Tag, val int8) error
- func (enc *Encoder) PutU16(tag Tag, val uint16) error
- func (enc *Encoder) PutU32(tag Tag, val uint32) error
- func (enc *Encoder) PutU64(tag Tag, val uint64) error
- func (enc *Encoder) PutU8(tag Tag, val uint8) error
- func (enc *Encoder) PutUTFString(tag Tag, str string) error
- func (enc *Encoder) StartContainer(tag Tag, tlvType Type) (outerContainerType Type, err error)
- func (enc *Encoder) Status() error
- func (enc *Encoder) WriteElementWithData(tlvType Type, tag Tag, data []byte) error
- type Tag
- type Type
Constants ¶
View Source
const ( Anonymous tagControl = 0x00 ContextSpecific tagControl = 0x20 CommonProfile2Bytes tagControl = 0x40 CommonProfile4Bytes tagControl = 0x60 ImplicitProfile2Bytes tagControl = 0x80 ImplicitProfile4Bytes tagControl = 0xA0 FullyQualified6Bytes tagControl = 0xC0 FullyQualified8Bytes tagControl = 0xE0 )
Variables ¶
View Source
var ByteLenError error = errors.New("tlv data length err")
View Source
var EndOfTLVError error = errors.New("end of tlv")
Functions ¶
func EstimateStructOverhead ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A Decoder reads and decodes tlv values from an input stream.
func NewDecoder ¶
NewDecoder returns a new decoder that reads from r. The decoder introduces its own buffering and may readData data from r beyond the JSON values requested.
func (*Decoder) EnterContainer ¶
func (*Decoder) ExitContainer ¶
func (*Decoder) GetBoolean ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func (*Encoder) EndContainer ¶
func (*Encoder) StartContainer ¶
type Type ¶
type Type int8
const ( TypeNotSpecified Type = -1 TypeUnknownContainer Type = -2 TypeSignedInteger Type = 0x00 //• Signed integers TypeUnsignedInteger Type = 0x04 //• Unsigned integers TypeUTF8String Type = 0x0C //• UTF-8 Strings TypeByteString Type = 0x10 //• Octet Strings TypeFloatingPointNumber Type = 0x0A //• Single or double-precision floating point numbers (following IEEE 754-2019) • Booleans TypeBoolean Type = 0x08 //• Booleans TypeNull Type = 0x14 //• Nulls TypeStructure Type = 0x15 TypeArray Type = 0x16 TypeList Type = 0x17 )
Click to show internal directories.
Click to hide internal directories.