cobs

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: ISC Imports: 1 Imported by: 6

README

Consistent Overhead Byte Stuffing

Build Status GoDoc

COBS encoder breaks a packet into one or more sequences of non-zero bytes. The encoding routine searches through the first 254 bytes of the packet looking for the first occurrence of a zero byte. If no zero is found, then a code of 0xFF is output, followed by the 254 non-zero bytes. If a zero is found, then the number of bytes examined, n, is output as the code byte, followed by the actual values of the (n-1) non-zero bytes up to (but not including) the zero byte. This process is repeated until all the bytes of the packet have been encoded.

See also: http://www.stuartcheshire.org/papers/COBSforToN.pdf

Documentation

Overview

Package cobs implements Consistent Overhead Byte Stuffing algorithm

COBS encoder breaks a packet into one or more sequences of non-zero bytes. The encoding routine searches through the first 254 bytes of the packet looking for the first occurrence of a zero byte. If no zero is found, then a code of 0xFF is output, followed by the 254 non-zero bytes. If a zero is found, then the number of bytes examined, n, is output as the code byte, followed by the actual values of the (n-1) non-zero bytes up to (but not including) the zero byte. This process is repeated until all the bytes of the packet have been encoded.

See also: http://www.stuartcheshire.org/papers/COBSforToN.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(p []byte) []byte

Decode a null-terminated frame to a slice of bytes

func Encode

func Encode(p []byte) []byte

Encode a slice of bytes to a null-terminated frame

func EncodedSize

func EncodedSize(n int) int

EncodedSize calculates size of encoded message

Types

This section is empty.

Jump to

Keyboard shortcuts

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