codec

package
v0.0.0-...-f2d3015 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeCtrlChar

func EncodeCtrlChar(cc ControlChar, p uint32) (out []byte)

func EncodeDataBytes

func EncodeDataBytes(data []byte) []byte

func IsCtrl

func IsCtrl(raw byte) bool

Types

type ControlChar

type ControlChar uint8
const (
	ChNone ControlChar = 0x00

	ChHandshake1  ControlChar = 0x80
	ChHandshake2  ControlChar = 0x81
	ChStartPacket ControlChar = 0x82
	ChEndPacket   ControlChar = 0x83
	ChErrorPacket ControlChar = 0x84
	ChFlowControl ControlChar = 0x85
	ChKeepAlive   ControlChar = 0x86
	ChEscapeSym   ControlChar = 0x87

	// ChCodecError is an alias, because EscapeSym never needs to be passed to an upper layer
	ChCodecError = ChEscapeSym
)

func (ControlChar) IsParametrized

func (cc ControlChar) IsParametrized() bool

func (ControlChar) String

func (cc ControlChar) String() string

func (ControlChar) Validate

func (cc ControlChar) Validate(param uint32)

type Decoder

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

func MakeCharDecoder

func MakeCharDecoder(readData func([]byte), readCtrl func(ControlChar)) *Decoder

func MakeDecoder

func MakeDecoder(readData func([]byte), readCtrl func(ControlChar, uint32)) *Decoder

MakeDecoder is the same as MakeCharDecoder, but additionally decodes parametrized control characters.

func (*Decoder) Decode

func (d *Decoder) Decode(raw []byte)

Jump to

Keyboard shortcuts

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