Documentation ¶
Index ¶
- Constants
- Variables
- type ADU
- func (*ADU) Descriptor() ([]byte, []int)deprecated
- func (x *ADU) GetAddress() uint32
- func (x *ADU) GetCrc16() uint32
- func (m *ADU) GetPDU() isADU_PDU
- func (x *ADU) GetPduRequest() *PDURequest
- func (x *ADU) GetPduResponse() *PDUResponse
- func (x *ADU) GetPduResponseException() *PDUResponseException
- func (x *ADU) GetTime() *timestamp.Timestamp
- func (adu *ADU) GetTimeTime() time.Time
- func (adu *ADU) IsException() bool
- func (adu *ADU) IsRequest() bool
- func (adu *ADU) IsResponse() bool
- func (adu *ADU) PrettyString() (s string)
- func (*ADU) ProtoMessage()
- func (x *ADU) ProtoReflect() protoreflect.Message
- func (x *ADU) Reset()
- func (adu *ADU) Size() int
- func (x *ADU) String() string
- type ADU_PduRequest
- type ADU_PduResponse
- type ADU_PduResponseException
- type Dissector
- type DissectorBuffer
- func (*DissectorBuffer) Descriptor() ([]byte, []int)deprecated
- func (x *DissectorBuffer) GetTimedBytes() []*TimedByte
- func (db *DissectorBuffer) PrettyString() (s string)
- func (*DissectorBuffer) ProtoMessage()
- func (x *DissectorBuffer) ProtoReflect() protoreflect.Message
- func (x *DissectorBuffer) Reset()
- func (db *DissectorBuffer) Size() int
- func (x *DissectorBuffer) String() string
- type ExceptionCode
- func (ExceptionCode) Descriptor() protoreflect.EnumDescriptor
- func (x ExceptionCode) Enum() *ExceptionCode
- func (ExceptionCode) EnumDescriptor() ([]byte, []int)deprecated
- func (x ExceptionCode) Number() protoreflect.EnumNumber
- func (x ExceptionCode) String() string
- func (ExceptionCode) Type() protoreflect.EnumType
- type FilterAnyModbus
- type FilterOnlyModbusRequest
- type FilterOnlyModbusResponseOrException
- type FunctionCode
- func (FunctionCode) Descriptor() protoreflect.EnumDescriptor
- func (x FunctionCode) Enum() *FunctionCode
- func (FunctionCode) EnumDescriptor() ([]byte, []int)deprecated
- func (x FunctionCode) Number() protoreflect.EnumNumber
- func (x FunctionCode) String() string
- func (FunctionCode) Type() protoreflect.EnumType
- type PDURequest
- type PDUResponse
- func (*PDUResponse) Descriptor() ([]byte, []int)deprecated
- func (x *PDUResponse) GetData() []byte
- func (x *PDUResponse) GetFunctionCode() uint32
- func (*PDUResponse) ProtoMessage()
- func (x *PDUResponse) ProtoReflect() protoreflect.Message
- func (x *PDUResponse) Reset()
- func (x *PDUResponse) String() string
- type PDUResponseException
- func (*PDUResponseException) Descriptor() ([]byte, []int)deprecated
- func (x *PDUResponseException) GetExceptionCode() uint32
- func (x *PDUResponseException) GetFunctionExceptionCode() uint32
- func (*PDUResponseException) ProtoMessage()
- func (x *PDUResponseException) ProtoReflect() protoreflect.Message
- func (x *PDUResponseException) Reset()
- func (x *PDUResponseException) String() string
- type Result
- type ResultFilter
- type Results
- type TimedByte
Constants ¶
const ( // DBMaxSizeWithoutNotify if more DataUnits than this in the buffer, then notity DBMaxSizeWithoutNotify = 4096 // DissectorFlushAfterSecondsModbusRTU flush data if older than this [seconds] DissectorFlushAfterSecondsModbusRTU = 5 )
const ( // ADUMinSize minium size of ADU in bytes ADUMinSize int = ADUSizePDUResponseException // ADUSizePDURequest size in bytes of a PDU request ADUSizePDURequest int = 8 // ADUSizePDUResponseException size in bytes of a PDU exception ADUSizePDUResponseException int = 5 )
Variables ¶
var ( FunctionCode_name = map[int32]string{ 0: "FuncCodeNouse", 4: "FuncCodeReadInputRegisters", 3: "FuncCodeReadHoldingRegisters", 6: "FuncCodeWriteSingleRegister", 16: "FuncCodeWriteMultipleRegisters", 23: "FuncCodeReadWriteMultipleRegisters", 22: "FuncCodeMaskWriteRegister", 24: "FuncCodeReadFIFOQueue", } FunctionCode_value = map[string]int32{ "FuncCodeNouse": 0, "FuncCodeReadInputRegisters": 4, "FuncCodeReadHoldingRegisters": 3, "FuncCodeWriteSingleRegister": 6, "FuncCodeWriteMultipleRegisters": 16, "FuncCodeReadWriteMultipleRegisters": 23, "FuncCodeMaskWriteRegister": 22, "FuncCodeReadFIFOQueue": 24, } )
Enum value maps for FunctionCode.
var ( ExceptionCode_name = map[int32]string{ 0: "ExceptionCodeNouse", 1: "ExceptionCodeIllegalFunction", 2: "ExceptionCodeIllegalDataAddress", 3: "ExceptionCodeIllegalDataValue", 4: "ExceptionCodeServerDeviceFailure", 5: "ExceptionCodeAcknowledge", 6: "ExceptionCodeServerDeviceBusy", 8: "ExceptionCodeMemoryParityError", 10: "ExceptionCodeGatewayPathUnavailable", 11: "ExceptionCodeGatewayTargetDeviceFailedToRespond", } ExceptionCode_value = map[string]int32{ "ExceptionCodeNouse": 0, "ExceptionCodeIllegalFunction": 1, "ExceptionCodeIllegalDataAddress": 2, "ExceptionCodeIllegalDataValue": 3, "ExceptionCodeServerDeviceFailure": 4, "ExceptionCodeAcknowledge": 5, "ExceptionCodeServerDeviceBusy": 6, "ExceptionCodeMemoryParityError": 8, "ExceptionCodeGatewayPathUnavailable": 10, "ExceptionCodeGatewayTargetDeviceFailedToRespond": 11, } )
Enum value maps for ExceptionCode.
var File_dissector_dissector_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type ADU ¶
type ADU struct { Address uint32 `protobuf:"varint,1,opt,name=address,proto3" json:"address,omitempty"` // 8bit // Types that are assignable to PDU: // *ADU_PduRequest // *ADU_PduResponse // *ADU_PduResponseException PDU isADU_PDU `protobuf_oneof:"PDU"` Crc16 uint32 `protobuf:"varint,15,opt,name=crc16,proto3" json:"crc16,omitempty"` // 16bit CRC Time *timestamp.Timestamp `protobuf:"bytes,16,opt,name=time,proto3" json:"time,omitempty"` // contains filtered or unexported fields }
ADU, Application Data Unit max size is 256 bytes
func NewADU ¶
func NewADU(db *DissectorBuffer, index int) (adu *ADU, err error)
NewADU builds an ADU from DissectorBuffer at position index. Returns err==nil on success Can be utilized to check if there is a ADU at specific position, also in cobination with IsRequest(), IsResponse(), IsException()
func (*ADU) Descriptor
deprecated
func (*ADU) GetAddress ¶
func (*ADU) GetPduRequest ¶
func (x *ADU) GetPduRequest() *PDURequest
func (*ADU) GetPduResponse ¶
func (x *ADU) GetPduResponse() *PDUResponse
func (*ADU) GetPduResponseException ¶
func (x *ADU) GetPduResponseException() *PDUResponseException
func (*ADU) GetTimeTime ¶
func (*ADU) IsException ¶
IsException return true if ADU is a Modbus Response with exceptions
func (*ADU) IsResponse ¶
IsResponse return true if ADU is a Modbus Response without exceptions
func (*ADU) PrettyString ¶
func (*ADU) ProtoMessage ¶
func (*ADU) ProtoMessage()
func (*ADU) ProtoReflect ¶
func (x *ADU) ProtoReflect() protoreflect.Message
type ADU_PduRequest ¶
type ADU_PduRequest struct {
PduRequest *PDURequest `protobuf:"bytes,2,opt,name=pduRequest,proto3,oneof"`
}
type ADU_PduResponse ¶
type ADU_PduResponse struct {
PduResponse *PDUResponse `protobuf:"bytes,3,opt,name=pduResponse,proto3,oneof"`
}
type ADU_PduResponseException ¶
type ADU_PduResponseException struct {
PduResponseException *PDUResponseException `protobuf:"bytes,4,opt,name=pduResponseException,proto3,oneof"`
}
type Dissector ¶
type Dissector struct { DissectorBuffer Consumer chan logger.DataUnit Producer chan Result // contains filtered or unexported fields }
func New ¶
func New(c *logger.Config, filter ResultFilter) (d *Dissector, err error)
New builds new dissector and starts waiting for data. DataUnits should be sent to GetConsumer() channel. Results can be fetched with GetResults(). Should be closed with Close() at the end.
func (*Dissector) GetConsumer ¶
GetConsumer return the channel to send DataUnits to
type DissectorBuffer ¶
type DissectorBuffer struct { TimedBytes []*TimedByte `protobuf:"bytes,1,rep,name=timedBytes,proto3" json:"timedBytes,omitempty"` // contains filtered or unexported fields }
Dissector
func (*DissectorBuffer) Descriptor
deprecated
func (*DissectorBuffer) Descriptor() ([]byte, []int)
Deprecated: Use DissectorBuffer.ProtoReflect.Descriptor instead.
func (*DissectorBuffer) GetTimedBytes ¶
func (x *DissectorBuffer) GetTimedBytes() []*TimedByte
func (*DissectorBuffer) PrettyString ¶
func (db *DissectorBuffer) PrettyString() (s string)
func (*DissectorBuffer) ProtoMessage ¶
func (*DissectorBuffer) ProtoMessage()
func (*DissectorBuffer) ProtoReflect ¶
func (x *DissectorBuffer) ProtoReflect() protoreflect.Message
func (*DissectorBuffer) Reset ¶
func (x *DissectorBuffer) Reset()
func (*DissectorBuffer) String ¶
func (x *DissectorBuffer) String() string
type ExceptionCode ¶
type ExceptionCode int32
Exception Code, 8bit
const ( ExceptionCode_ExceptionCodeNouse ExceptionCode = 0 // unused, protobuf3 requirement ExceptionCode_ExceptionCodeIllegalFunction ExceptionCode = 1 ExceptionCode_ExceptionCodeIllegalDataAddress ExceptionCode = 2 ExceptionCode_ExceptionCodeIllegalDataValue ExceptionCode = 3 ExceptionCode_ExceptionCodeServerDeviceFailure ExceptionCode = 4 ExceptionCode_ExceptionCodeAcknowledge ExceptionCode = 5 ExceptionCode_ExceptionCodeServerDeviceBusy ExceptionCode = 6 ExceptionCode_ExceptionCodeMemoryParityError ExceptionCode = 8 ExceptionCode_ExceptionCodeGatewayTargetDeviceFailedToRespond ExceptionCode = 11 )
func (ExceptionCode) Descriptor ¶
func (ExceptionCode) Descriptor() protoreflect.EnumDescriptor
func (ExceptionCode) Enum ¶
func (x ExceptionCode) Enum() *ExceptionCode
func (ExceptionCode) EnumDescriptor
deprecated
func (ExceptionCode) EnumDescriptor() ([]byte, []int)
Deprecated: Use ExceptionCode.Descriptor instead.
func (ExceptionCode) Number ¶
func (x ExceptionCode) Number() protoreflect.EnumNumber
func (ExceptionCode) String ¶
func (x ExceptionCode) String() string
func (ExceptionCode) Type ¶
func (ExceptionCode) Type() protoreflect.EnumType
type FilterAnyModbus ¶
type FilterAnyModbus struct{}
type FilterOnlyModbusRequest ¶
type FilterOnlyModbusRequest struct{}
type FilterOnlyModbusResponseOrException ¶
type FilterOnlyModbusResponseOrException struct{}
type FunctionCode ¶
type FunctionCode int32
Function Code, 16bit
const ( FunctionCode_FuncCodeNouse FunctionCode = 0 // unused, protobuf3 requirement FunctionCode_FuncCodeReadInputRegisters FunctionCode = 4 FunctionCode_FuncCodeReadHoldingRegisters FunctionCode = 3 FunctionCode_FuncCodeWriteSingleRegister FunctionCode = 6 FunctionCode_FuncCodeWriteMultipleRegisters FunctionCode = 16 FunctionCode_FuncCodeReadWriteMultipleRegisters FunctionCode = 23 FunctionCode_FuncCodeMaskWriteRegister FunctionCode = 22 FunctionCode_FuncCodeReadFIFOQueue FunctionCode = 24 )
func (FunctionCode) Descriptor ¶
func (FunctionCode) Descriptor() protoreflect.EnumDescriptor
func (FunctionCode) Enum ¶
func (x FunctionCode) Enum() *FunctionCode
func (FunctionCode) EnumDescriptor
deprecated
func (FunctionCode) EnumDescriptor() ([]byte, []int)
Deprecated: Use FunctionCode.Descriptor instead.
func (FunctionCode) Number ¶
func (x FunctionCode) Number() protoreflect.EnumNumber
func (FunctionCode) String ¶
func (x FunctionCode) String() string
func (FunctionCode) Type ¶
func (FunctionCode) Type() protoreflect.EnumType
type PDURequest ¶
type PDURequest struct { FunctionCode uint32 `protobuf:"varint,1,opt,name=functionCode,proto3" json:"functionCode,omitempty"` // 8bit Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
PDU, Protocol Data Unit max size is 253 bytes
func (*PDURequest) Descriptor
deprecated
func (*PDURequest) Descriptor() ([]byte, []int)
Deprecated: Use PDURequest.ProtoReflect.Descriptor instead.
func (*PDURequest) GetData ¶
func (x *PDURequest) GetData() []byte
func (*PDURequest) GetFunctionCode ¶
func (x *PDURequest) GetFunctionCode() uint32
func (*PDURequest) ProtoMessage ¶
func (*PDURequest) ProtoMessage()
func (*PDURequest) ProtoReflect ¶
func (x *PDURequest) ProtoReflect() protoreflect.Message
func (*PDURequest) Reset ¶
func (x *PDURequest) Reset()
func (*PDURequest) String ¶
func (x *PDURequest) String() string
type PDUResponse ¶
type PDUResponse struct { FunctionCode uint32 `protobuf:"varint,1,opt,name=functionCode,proto3" json:"functionCode,omitempty"` // 8bit Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*PDUResponse) Descriptor
deprecated
func (*PDUResponse) Descriptor() ([]byte, []int)
Deprecated: Use PDUResponse.ProtoReflect.Descriptor instead.
func (*PDUResponse) GetData ¶
func (x *PDUResponse) GetData() []byte
func (*PDUResponse) GetFunctionCode ¶
func (x *PDUResponse) GetFunctionCode() uint32
func (*PDUResponse) ProtoMessage ¶
func (*PDUResponse) ProtoMessage()
func (*PDUResponse) ProtoReflect ¶
func (x *PDUResponse) ProtoReflect() protoreflect.Message
func (*PDUResponse) Reset ¶
func (x *PDUResponse) Reset()
func (*PDUResponse) String ¶
func (x *PDUResponse) String() string
type PDUResponseException ¶
type PDUResponseException struct { FunctionExceptionCode uint32 `protobuf:"varint,1,opt,name=functionExceptionCode,proto3" json:"functionExceptionCode,omitempty"` // 8bit ExceptionCode uint32 `protobuf:"varint,2,opt,name=exceptionCode,proto3" json:"exceptionCode,omitempty"` // contains filtered or unexported fields }
func (*PDUResponseException) Descriptor
deprecated
func (*PDUResponseException) Descriptor() ([]byte, []int)
Deprecated: Use PDUResponseException.ProtoReflect.Descriptor instead.
func (*PDUResponseException) GetExceptionCode ¶
func (x *PDUResponseException) GetExceptionCode() uint32
func (*PDUResponseException) GetFunctionExceptionCode ¶
func (x *PDUResponseException) GetFunctionExceptionCode() uint32
func (*PDUResponseException) ProtoMessage ¶
func (*PDUResponseException) ProtoMessage()
func (*PDUResponseException) ProtoReflect ¶
func (x *PDUResponseException) ProtoReflect() protoreflect.Message
func (*PDUResponseException) Reset ¶
func (x *PDUResponseException) Reset()
func (*PDUResponseException) String ¶
func (x *PDUResponseException) String() string
type Result ¶
type Result struct { Adu *ADU `protobuf:"bytes,1,opt,name=adu,proto3" json:"adu,omitempty"` // contains filtered or unexported fields }
this depends on dissected protocol. Now it only supports Modbus ADU. Can be extended with `oneof`
func (*Result) Descriptor
deprecated
func (*Result) PrettyString ¶
func (*Result) ProtoMessage ¶
func (*Result) ProtoMessage()
func (*Result) ProtoReflect ¶
func (x *Result) ProtoReflect() protoreflect.Message
type ResultFilter ¶
type ResultFilter interface {
// contains filtered or unexported methods
}
type Results ¶
type Results struct { Results []*Result `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` // contains filtered or unexported fields }
func (*Results) Descriptor
deprecated
func (*Results) GetResults ¶
func (*Results) ProtoMessage ¶
func (*Results) ProtoMessage()
func (*Results) ProtoReflect ¶
func (x *Results) ProtoReflect() protoreflect.Message
type TimedByte ¶
type TimedByte struct { Time *timestamp.Timestamp `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"` Byte uint32 `protobuf:"varint,2,opt,name=byte,proto3" json:"byte,omitempty"` // 8bit // contains filtered or unexported fields }
func (*TimedByte) Descriptor
deprecated
func (*TimedByte) ProtoMessage ¶
func (*TimedByte) ProtoMessage()
func (*TimedByte) ProtoReflect ¶
func (x *TimedByte) ProtoReflect() protoreflect.Message