Documentation ¶
Index ¶
- Constants
- Variables
- func ApplicationByte(num uint8) uint8
- func ContextByte(num uint8) uint8
- func DecodeAny(in []byte, val any) (int, error)
- func UniversalByte(num uint8) uint8
- type Decoder
- func (c *Decoder) Bytes() []byte
- func (c *Decoder) DecodeInteger() (int, error)
- func (c *Decoder) DecodeUTF8() (string, error)
- func (c *Decoder) DecodeUniversal() ([]int, error)
- func (c *Decoder) Len() int
- func (c *Decoder) Peek() (byte, error)
- func (c *Decoder) Read(tag uint8, compareByte func(num uint8) uint8) (*Decoder, bool, error)
- func (c *Decoder) ReadByte() (byte, error)
- func (c *Decoder) ReadEnd() (bool, error)
- type Encoder
Constants ¶
const ( // ParameterType glow data field parameter type. ParameterType = "parameter" // QualifiedParameterType glow data field qualified parameter type. QualifiedParameterType = "qualified_parameter" // QualifiedNodeType glow data field qualified node type. QualifiedNodeType = "qualified_node" // NodeType glow data field node type. NodeType = "node" // FunctionType glow data field function type. FunctionType = "function" // EmberGetDirCommand integer for request dir command, based on S101 and glow protocol. EmberGetDirCommand = 32 // EmberGetUnsubscribeCommand integer for request Unsubscribe command, based on S101 and glow protocol. EmberGetUnsubscribeCommand = 31 // RootElementCollectionTag tag for defining glow root element collection encoding command. RootElementCollectionTag = 0 // RootElementTag tag for defining glow root element collection. RootElementTag = 11 // ElementCollectionTag tag for element collection. ElementCollectionTag = 4 // ContextZeroTag tag for top level context. ContextZeroTag = 0 // ContextTagOne tag for context // Node means data contains content. ContextTagOne = 1 // ContextTagTwo tag for context // Node means data contains children. ContextTagTwo = 2 // QualifiedParameterTag for defining glow qualified parameter tag. QualifiedParameterTag = 9 // QualifiedNodeTag for defining glow qualified node tag. QualifiedNodeTag = 10 // SetTag tag for defining Ember set structure. SetTag = 49 // UniversalObjectTag context universal object tag. UniversalObjectTag = 0x0D // UTF8StringTag context utf8String object tag. UTF8StringTag = 0x0C )
Variables ¶
ErrNoLenByte error when length of bytes can not be determined.
Functions ¶
func ApplicationByte ¶
ApplicationByte have the same meaning wherever they are seen and used.
func ContextByte ¶
ContextByte context-specific tags depends on the location where they are seen.
func DecodeAny ¶
DecodeAny decodes native asn1 value.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decoder for ASN1 glow data.
func (*Decoder) Bytes ¶
Bytes wrapper to containing decoders data bytes.
func (*Decoder) DecodeInteger ¶
DecodeInteger decodes the following integer.
func (*Decoder) DecodeUTF8 ¶
DecodeUTF8 decoded the following utf8 data type of glow.
func (*Decoder) DecodeUniversal ¶
DecodeUniversal decoded the following universal data type of glow, currently only used for universal path decoding, witch is an array of integers.
func (*Decoder) Len ¶
Len Bytes wrapper to containing decoders data bytes.
func (*Decoder) Peek ¶
Peek returns the next byte, but does not remove it from the buffer.
func (*Decoder) Read ¶
Read reads the next glow data block of the appropriate type, it checks the glow tag against the provided compare function and if they match it reads the glow data block and returns it as it's own decoded, original decoder might have more data left, THIS DOES NOT READ ALL THE DATA. If no length byte is found in data returns ALL remaining bytes. Returns True if next element length is unknown.
func (*Decoder) ReadByte ¶
ReadByte reads one byte from the underlining bytes buffer in decoder.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder encoder ASN1 glow data.
func NewEncoder ¶
func NewEncoder() *Encoder
NewEncoder creates a new encoder with an initialized data buffer, but no actual data.
func (*Encoder) GetData ¶
GetData returns all data contained in the encoder.
func (*Encoder) WriteCommand ¶
WriteCommand writes a get dir command request into the buffer.
func (*Encoder) WriteRequest ¶
WriteRequest writes a request into the encoder buffer, for the provided element type, currently supports parameters, qualified parameters, nodes qualified nodes and functions.
func (*Encoder) WriteRootTreeRequest ¶
WriteRootTreeRequest writes a request for root element collection into the buffer.