siemens

package
v0.0.0-...-9842712 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: Apache-2.0, ISC, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	S7_PROTOCOL_ID                  = byte(0x32)
	S7_REQUEST_ID                   = uint16(0)
	S7_REQUEST                      = byte(0x01)
	S7_REQUEST_USER_DATA            = byte(0x07)
	S7_ACKNOWLEDGEMENT              = byte(0x02)
	S7_RESPONSE                     = byte(0x03)
	S7_SZL_REQUEST                  = byte(0x04)
	S7_SZL_FUNCTIONS                = byte(0x04)
	S7_SZL_READ                     = byte(0x01)
	S7_SZL_MODULE_IDENTIFICATION    = uint16(0x11)
	S7_SZL_COMPONENT_IDENTIFICATION = uint16(0x1c)
	S7_DATA_BYTE_OFFSET             = 12 // offset for real data
)

Variables

View Source
var (
	S7_ERROR_CODES = map[uint32]string{

		0x05: "Address error",
		0x0a: "Item not available",

		0x8104: "Context not supported",
		0x8500: "Wrong PDU size",
	}
)

Functions

func GetS7Banner

func GetS7Banner(logStruct *S7Log, connection net.Conn) (err error)

Types

type COTPConnectionPacket

type COTPConnectionPacket struct {
	DestinationRef  uint16
	SourceRef       uint16
	DestinationTSAP uint16
	SourceTSAP      uint16
	TPDUSize        byte
}

RFC 892

func (*COTPConnectionPacket) Marshal

func (cotpConnPacket *COTPConnectionPacket) Marshal() ([]byte, error)

Encodes a COTPConnectionPacket to binary

func (*COTPConnectionPacket) Unmarshal

func (cotpConnPacket *COTPConnectionPacket) Unmarshal(bytes []byte) error

Decodes a COTPConnectionPacket from binary that must be a connection confirmation

type COTPDataPacket

type COTPDataPacket struct {
	Data []byte
}

func (*COTPDataPacket) Marshal

func (cotpDataPacket *COTPDataPacket) Marshal() ([]byte, error)

Encodes a COTPDataPacket to binary

func (*COTPDataPacket) Unmarshal

func (cotpDataPacket *COTPDataPacket) Unmarshal(bytes []byte) error

Decodes a COTPDataPacket from binary

type S7Error

type S7Error struct{}

func (*S7Error) New

func (s7Error *S7Error) New(errorCode uint32) error

type S7Log

type S7Log struct {
	IsS7               bool   `json:"is_s7"`
	System             string `json:"system,omitempty"`
	Module             string `json:"module,omitempty"`
	PlantId            string `json:"plant_id,omitempty"`
	Copyright          string `json:"copyright,omitempty"`
	SerialNumber       string `json:"serial_number,omitempty"`
	ReservedForOS      string `json:"reserved_for_os,omitempty"`
	ModuleType         string `json:"module_type,omitempty"`
	MemorySerialNumber string `json:"memory_serial_number,omitempty"`
	CpuProfile         string `json:"cpu_profile,omitempty"`
	OEMId              string `json:"oem_id,omitempty"`
	Location           string `json:"location,omitempty"`
	ModuleId           string `json:"module_id,omitempty"`
	Hardware           string `json:"hardware,omitempty"`
	Firmware           string `json:"firmware,omitempty"`
}

type S7Packet

type S7Packet struct {
	PDUType    byte
	RequestId  uint16
	Parameters []byte
	Data       []byte
	Error      uint16
}

func (*S7Packet) Marshal

func (s7Packet *S7Packet) Marshal() ([]byte, error)

Encodes a S7Packet to binary

func (*S7Packet) Unmarshal

func (s7Packet *S7Packet) Unmarshal(bytes []byte) (err error)

Decodes a S7Packet from binary

type TPKTPacket

type TPKTPacket struct {
	Data []byte
}

RFC 1006

func (*TPKTPacket) Marshal

func (tpktPacket *TPKTPacket) Marshal() ([]byte, error)

Encodes a TPKTPacket to binary

func (*TPKTPacket) Unmarshal

func (tpktPacket *TPKTPacket) Unmarshal(bytes []byte) error

Decodes a TPKTPacket from binary

Jump to

Keyboard shortcuts

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