Documentation
¶
Index ¶
Constants ¶
const MaxValueBytes = 256
Variables ¶
var ErrDataNotFound = errors.New("data read hit EOF before specified length was reached")
var ErrTagEmpty = errors.New("tag contained no parsed data")
var ErrTagNotFound = errors.New("tag not found in TLV collection")
var ErrValueLengthExceedsMax = errors.New("value exceeds max allowable length")
Functions ¶
func EncodeTLVList ¶
Takes a list of TLVs and encodes them as serialized bytes in FIFO order
Types ¶
type TLVCollection ¶
func ParseTLVPacket ¶
func ParseTLVPacket(data []byte, constructedTags ...byte) (TLVCollection, error)
Parses a TLV encoded response structure Returning a flattened map where the keys are tags and the value is a slice of raw bytes, one entry for each tag instance found. For any "constructedTags" passed, the parser will recurse into the value of that tag to find internal TLV's and append them to the collection as flattened entries
func (TLVCollection) FindTag ¶
func (coll TLVCollection) FindTag(tag byte) (value []byte, err error)
FindTag takes a tag as input and returns the first instance of the tag's value
func (TLVCollection) FindTags ¶
func (coll TLVCollection) FindTags(tag byte) (value [][]byte, err error)
Findtags takes a tag as input and returns all instances of the tag's values as a slice of slice of byte
func (TLVCollection) GetRemainingTLVs ¶
func (coll TLVCollection) GetRemainingTLVs(tags []byte) (remaining []TLV)
Removes tags from a collection, returning the remaining TLV's Useful for slicing out extended TLVs after the known ones are parsed