per

package
v0.0.0-...-8b9ded4 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package per is implementation for Basic Pckage Encoding Rule (PER) in ALIGNED variant. document version: T-REC-X.691-201508

Index

Constants

This section is empty.

Variables

View Source
var EncSequenceOf = EncEnumerated

EncSequenceOf return Sequence-Of Preamble. 20. Encoding the sequence-of type

Functions

func DecLengthDeterminant

func DecLengthDeterminant(pdu *[]byte, max int) (length int, err error)

func EncNonNegativeBinaryInteger

func EncNonNegativeBinaryInteger(input uint) (v []byte, err error)

EncNonNegativeBinaryInteger is the implementation for 11.3 Encoding as a non-negative-binary-integer

Types

type BitField

type BitField struct {
	Value []byte
	Len   int
}

func EncBitString

func EncBitString(input []byte, inputlen, min, max int, extmark bool) (
	bf BitField, v []byte, err error)

EncBitString returns multi-byte BIT STRING 16. Encoding the bitstering type

func EncChoice

func EncChoice(input, min, max int, extmark bool) (
	bf BitField, v []byte, err error)

EncChoice is the implementation for 23. Encoding the choice type

func EncConstrainedWholeNumber

func EncConstrainedWholeNumber(input, min, max int64) (bf BitField, err error)

EncConstrainedWholeNumber is the implementation for 11.5 Encoding of constrained whole number.

func EncEnumerated

func EncEnumerated(input, min, max uint, extmark bool) (
	bf BitField, v []byte, err error)

EncEnumerated is the implementation for 14. Encoding the enumerated type

func EncInteger

func EncInteger(input, min, max int64, extmark bool) (
	bf BitField, v []byte, err error)

EncInteger is the implementation for 13. Encoding the integer type but it is only for the case of single value and constrained whole nuber.

func EncLengthDeterminant

func EncLengthDeterminant(input, min, max int) (bf BitField, err error)

EncLengthDeterminant is the implementation for 11.9 General rules for encoding a length determinant

func EncOctetString

func EncOctetString(input []byte, min, max int, extmark bool) (
	bf BitField, v []byte, err error)

EncOctetString returns multi-byte OCTET STRING 17. Encoding the octetstring type

  • the length of returned value can be calculated by len().
  • returned value can be len(value) == 0 if the specified octet string has fixed length and the lenght is less than 3. And then the octet string is encoded as bit field.

func EncSequence

func EncSequence(extmark bool, optnum int, optflag uint) (
	b BitField, err error)

EncSequence return Sequence Preamble but it just returns 0x00 for now. 19. Encoding the sequence type

func MergeBitField

func MergeBitField(in1 BitField, in2 BitField) (out BitField)

MergeBitField is utility function for merging bit-field. e.g. preamble or short integer value is not octet alined value, so those fields need to be packed in same octets.

func ShiftLeft

func ShiftLeft(in BitField, shiftlen int) (out BitField)

ShiftLeft is utility function to left shift the octet values.

func ShiftLeftMost

func ShiftLeftMost(in BitField) (out BitField)

ShiftLeftMost is utility function to shift the octet values to the leftmost.

func ShiftRight

func ShiftRight(in BitField, shiftlen int) (out BitField)

ShiftRight is utility function to right shift the octet values.

Jump to

Keyboard shortcuts

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