header

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: Apache-2.0, BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const Length = 5

Length defines the length of a DRNG header

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	PayloadType Type   // message type
	InstanceID  uint32 // identifier of the DRNG instance
}

Header defines defines a DRNG payload header

func FromBytes

func FromBytes(bytes []byte, optionalTargetObject ...*Header) (result Header, consumedBytes int, err error)

FromBytes unmarshals a header from a sequence of bytes. It either creates a new header or fills the optionally provided object with the parsed information.

func New

func New(payloadType Type, instanceID uint32) Header

New creates a new DRNG payload header for the given type and instance id.

func Parse

func Parse(marshalUtil *marshalutil.MarshalUtil) (Header, error)

Parse is a wrapper for simplified unmarshaling in a byte stream using the marshalUtil package.

func (*Header) Bytes

func (header *Header) Bytes() (bytes []byte)

Bytes returns the header in serialized bytes form.

type Type

type Type = byte

Type defines the data model of a DRNG payload type

const (
	// TypeCollectiveBeacon defines a CollectiveBeacon payload type
	TypeCollectiveBeacon Type = 1
)

Jump to

Keyboard shortcuts

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