network

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxMessageLength = 2048
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ASCII4BytesHeader

type ASCII4BytesHeader struct {
	Len int
}

ASCII4BytesHeader is 4 bytes ASCII encoded length

func NewASCII4BytesHeader

func NewASCII4BytesHeader() *ASCII4BytesHeader

func (*ASCII4BytesHeader) Length

func (h *ASCII4BytesHeader) Length() int

func (*ASCII4BytesHeader) ReadFrom

func (h *ASCII4BytesHeader) ReadFrom(r io.Reader) (int, error)

func (*ASCII4BytesHeader) SetLength

func (h *ASCII4BytesHeader) SetLength(length int)

func (*ASCII4BytesHeader) WriteTo

func (h *ASCII4BytesHeader) WriteTo(w io.Writer) (int, error)

type BCD2BytesHeader

type BCD2BytesHeader struct {
	Len int
}

2 bytes of BCD encoded length

func NewBCD2BytesHeader

func NewBCD2BytesHeader() *BCD2BytesHeader

func (*BCD2BytesHeader) Length

func (h *BCD2BytesHeader) Length() int

func (*BCD2BytesHeader) ReadFrom

func (h *BCD2BytesHeader) ReadFrom(r io.Reader) (int, error)

func (*BCD2BytesHeader) SetLength

func (h *BCD2BytesHeader) SetLength(length int)

func (*BCD2BytesHeader) WriteTo

func (h *BCD2BytesHeader) WriteTo(w io.Writer) (int, error)

type Binary2Bytes

type Binary2Bytes struct {
	Len uint16
}

func NewBinary2BytesHeader

func NewBinary2BytesHeader() *Binary2Bytes

func (*Binary2Bytes) Length

func (h *Binary2Bytes) Length() int

func (*Binary2Bytes) ReadFrom

func (h *Binary2Bytes) ReadFrom(r io.Reader) (int, error)

func (*Binary2Bytes) SetLength

func (h *Binary2Bytes) SetLength(length int) error

func (*Binary2Bytes) WriteTo

func (h *Binary2Bytes) WriteTo(w io.Writer) (int, error)
type Header interface {
	// WriteTo encoded length into Writer
	WriteTo(w io.Writer) (int, error)

	// ReadFrom reads header (N bytes) from the Reader
	ReadFrom(r io.Reader) (int, error)

	// SetLength sets the length of the message
	SetLength(length int)

	// Length returns the length of the message
	Length() int
}

Header is network header interface to write/read encoded message legnth

type VMLH

type VMLH struct {
	Len uint16

	// When no message traffic during at least 10 seconds,
	// Visa sends a session control message (Heartbeat or Idle-Time)
	// IsSessionControl flag is set to true for such messages
	IsSessionControl bool
}

func NewVMLHeader

func NewVMLHeader() *VMLH

func (*VMLH) Length

func (h *VMLH) Length() int

func (*VMLH) ReadFrom

func (h *VMLH) ReadFrom(r io.Reader) (int, error)

func (*VMLH) SetLength

func (h *VMLH) SetLength(length int) error

func (*VMLH) WriteTo

func (h *VMLH) WriteTo(w io.Writer) (int, error)

Jump to

Keyboard shortcuts

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