tcobs

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package tcobs implements ./docs/TCOBSSpecification.md. For encoding create an Encoder and use the Write method as shown in TestWrite. For decoding create a Decoder and use the Read method as shown in TestSingleRead and TestMultiRead. It is possible to use only the functions tcobs.Decode or tcobs.CEncode. Package tcobs is also a helper for testing the target C-code. Each C function gets a Go wrapper which ist tested in appropriate test functions. For some reason inside the tcobs_test.go an 'import "C"' is not possible.

Index

Constants

View Source
const (
	N        = 0xA0 // noop sigil byte
	Z1       = 0x20 // 1-zero sigil byte
	Z2       = 0x40 // 2-zero sigil byte
	Z3       = 0x60 // 3-zero sigil byte
	F2       = 0xC0 // 2-FF sigil byte
	F3       = 0xE0 // 3-FF sigil byte
	F4       = 0x80 // 4-FF sigil byte
	R2       = 0x08 // 2-repeat sigil byte
	R3       = 0x10 // 3-repeat sigil byte
	R4       = 0x18 // 4-repeat sigil byte
	Reserved = 0x00 // reserved sigil byte
)

Variables

This section is empty.

Functions

func Decode

func Decode(d, in []byte) (n int, e error)

Decode decodes a TCOBS frame `in` (without 0-delimiter) to `d` and returns as `n` the valid data length from the end in `d`. ATTENTION: d is filled from the end! decoded := d[len(d)-n:] is the final result. In case of an error n is 0. n can be 0 without having an error. Framing with 0-delimiter to be done before is assumed, so no 0-checks performed. For details see TCOBSSpecification.md.

func NewDecoder

func NewDecoder(r io.Reader, size int) (p *decoder)

NewDecoder creates a decoder instance and returns its address. r will be used as inner reader. size is used as size for the inner buffers. Max one decoded TCOBS package is returned by Read.

Types

This section is empty.

Jump to

Keyboard shortcuts

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