message

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CRLF = "\r\n"
)

Variables

View Source
var Readers map[string]Reader

Functions

func CreateModbusRequest

func CreateModbusRequest(transactionID uint16, unitID byte, functionCode byte, data []byte) []byte

CreateModbusRequest creates a properly formatted Modbus request

func GetModbusExceptionCode

func GetModbusExceptionCode(msg []byte) (byte, error)

GetModbusExceptionCode extracts exception code if present

func IsModbusException

func IsModbusException(msg []byte) bool

IsModbusException checks if a Modbus response is an exception

func ParseModbusFunction

func ParseModbusFunction(msg []byte) (byte, error)

ParseModbusFunction extracts the function code from a Modbus message

Types

type EchoMessageReader

type EchoMessageReader struct {
}

func (EchoMessageReader) Name

func (e EchoMessageReader) Name() string

func (EchoMessageReader) ReadMessage

func (e EchoMessageReader) ReadMessage(conn io.Reader) ([]byte, error)

ReadMessage message is expected \n terminated

type HTTPMessageReader

type HTTPMessageReader struct{}

HTTPMessageReader for the HTTP protocol

func (HTTPMessageReader) Name

func (H HTTPMessageReader) Name() string

func (HTTPMessageReader) ReadMessage

func (H HTTPMessageReader) ReadMessage(conn io.Reader) ([]byte, error)

ReadMessage reads and parses an HTTP message from the connection

type ISO8583MessageReader

type ISO8583MessageReader struct {
}

func (ISO8583MessageReader) Name

func (I ISO8583MessageReader) Name() string

func (ISO8583MessageReader) ReadMessage

func (I ISO8583MessageReader) ReadMessage(conn io.Reader) ([]byte, error)

ReadMessage assume including a header with the length of the 8583 message http://j8583.sourceforge.net/desc8583en.html otherwise, we have to parse iso8583 message

type MPUMessageReader

type MPUMessageReader struct {
}

MPUMessageReader for reading MPU Switch format iso8583

func (MPUMessageReader) Name

func (M MPUMessageReader) Name() string

func (MPUMessageReader) ReadMessage

func (M MPUMessageReader) ReadMessage(conn io.Reader) ([]byte, error)

type ModbusMessageReader

type ModbusMessageReader struct{}

func (ModbusMessageReader) Name

func (m ModbusMessageReader) Name() string

func (ModbusMessageReader) ReadMessage

func (m ModbusMessageReader) ReadMessage(conn io.Reader) ([]byte, error)

type Reader

type Reader interface {
	ReadMessage(conn io.Reader) ([]byte, error)
	Name() string
}

Reader read message for specified application protocol from client and target server

Jump to

Keyboard shortcuts

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