Documentation
¶
Index ¶
- func WithTrappedClientContract(trappedClientContract TrappedClientContract) func(*TrappedClient)
- func WithTrappedServerContract(trappedServerContract TrappedServerContract) GenericApplier[*TrappedServer]
- type TrappedApplicationServiceElement
- func (s *TrappedApplicationServiceElement) Confirmation(args Args, kwArgs KWArgs) error
- func (s *TrappedApplicationServiceElement) GetConfirmationReceived() PDU
- func (s *TrappedApplicationServiceElement) GetIndicationReceived() PDU
- func (s *TrappedApplicationServiceElement) GetRequestSent() PDU
- func (s *TrappedApplicationServiceElement) GetResponseSent() PDU
- func (s *TrappedApplicationServiceElement) Indication(args Args, kwArgs KWArgs) error
- func (s *TrappedApplicationServiceElement) Request(args Args, kwArgs KWArgs) error
- func (s *TrappedApplicationServiceElement) Response(args Args, kwArgs KWArgs) error
- func (s *TrappedApplicationServiceElement) String() string
- type TrappedApplicationServiceElementRequirements
- type TrappedClient
- func (t *TrappedClient) Confirmation(args Args, kwArgs KWArgs) error
- func (t *TrappedClient) GetConfirmationReceived() PDU
- func (t *TrappedClient) GetRequestSent() PDU
- func (t *TrappedClient) Request(args Args, kwArgs KWArgs) error
- func (d *TrappedClient) Serialize() ([]byte, error)
- func (d *TrappedClient) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error
- func (d *TrappedClient) String() string
- type TrappedClientContract
- type TrappedClientStateMachine
- type TrappedServer
- func (t *TrappedServer) GetIndicationReceived() PDU
- func (t *TrappedServer) GetResponseSent() PDU
- func (t *TrappedServer) Indication(args Args, kwArgs KWArgs) error
- func (t *TrappedServer) Response(args Args, kwArgs KWArgs) error
- func (d *TrappedServer) Serialize() ([]byte, error)
- func (d *TrappedServer) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error
- func (d *TrappedServer) String() string
- type TrappedServerContract
- type TrappedServerStateMachine
- type TrappedServiceAccessPoint
- func (s *TrappedServiceAccessPoint) GetSapConfirmationReceived() PDU
- func (s *TrappedServiceAccessPoint) GetSapIndicationReceived() PDU
- func (s *TrappedServiceAccessPoint) GetSapRequestSent() PDU
- func (s *TrappedServiceAccessPoint) GetSapResponseSent() PDU
- func (s *TrappedServiceAccessPoint) SapConfirmation(args Args, kwArgs KWArgs) error
- func (s *TrappedServiceAccessPoint) SapIndication(args Args, kwArgs KWArgs) error
- func (s *TrappedServiceAccessPoint) SapRequest(args Args, kwArgs KWArgs) error
- func (s *TrappedServiceAccessPoint) SapResponse(args Args, kwArgs KWArgs) error
- type TrappedServiceAccessPointRequirements
- type TrappedState
- func (t *TrappedState) AfterReceive(pdu PDU)
- func (t *TrappedState) AfterSend(pdu PDU)
- func (t *TrappedState) BeforeReceive(pdu PDU)
- func (t *TrappedState) BeforeSend(pdu PDU)
- func (t *TrappedState) Equals(other state_machine.State) bool
- func (t *TrappedState) String() string
- func (t *TrappedState) UnexpectedReceive(pdu PDU)
- type TrappedStateMachine
- func (t *TrappedStateMachine) AfterReceive(pdu PDU)
- func (t *TrappedStateMachine) AfterSend(pdu PDU)
- func (t *TrappedStateMachine) BeforeReceive(pdu PDU)
- func (t *TrappedStateMachine) BeforeSend(pdu PDU)
- func (t *TrappedStateMachine) DecorateState(state State) State
- func (t *TrappedStateMachine) GetSent() PDU
- func (t *TrappedStateMachine) Send(args Args, kwArgs KWArgs) error
- func (t *TrappedStateMachine) UnexpectedReceive(pdu PDU)
- type Trapper
- func (t *Trapper) AfterReceive(pdu PDU)
- func (t *Trapper) AfterSend(pdu PDU)
- func (t *Trapper) BeforeReceive(pdu PDU)
- func (t *Trapper) BeforeSend(pdu PDU)
- func (t *Trapper) GetAfterReceivePdu() PDU
- func (t *Trapper) GetAfterSendPdu() PDU
- func (t *Trapper) GetBeforeReceivePdu() PDU
- func (t *Trapper) GetBeforeSendPdu() PDU
- func (t *Trapper) GetUnexpectedReceivePDU() PDU
- func (t *Trapper) UnexpectedReceive(pdu PDU)
- type TrapperRequirements
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithTrappedClientContract ¶
func WithTrappedClientContract(trappedClientContract TrappedClientContract) func(*TrappedClient)
func WithTrappedServerContract ¶
func WithTrappedServerContract(trappedServerContract TrappedServerContract) GenericApplier[*TrappedServer]
Types ¶
type TrappedApplicationServiceElement ¶
type TrappedApplicationServiceElement struct { ApplicationServiceElementContract // contains filtered or unexported fields }
TrappedApplicationServiceElement Note that while this class inherits from ApplicationServiceElement, it
doesn't provide any stubbed behavior for indication() or confirmation(), so if these functions are called it will still raise NotImplementedError. To provide these functions, write a ServiceAccessPoint derived class and stuff it in the inheritance sequence: struct Snort(ApplicationServiceElement) func indication(pdu): ...do something... func confirmation(pdu) ...do something... struct TrappedSnort(TrappedApplicationServiceElement, Snort) The Snort functions will be called after the PDU is trapped.
func NewTrappedApplicationServiceElement ¶
func NewTrappedApplicationServiceElement(localLog zerolog.Logger, requirements TrappedApplicationServiceElementRequirements, options ...Option) (*TrappedApplicationServiceElement, error)
func (*TrappedApplicationServiceElement) Confirmation ¶
func (s *TrappedApplicationServiceElement) Confirmation(args Args, kwArgs KWArgs) error
func (*TrappedApplicationServiceElement) GetConfirmationReceived ¶
func (s *TrappedApplicationServiceElement) GetConfirmationReceived() PDU
func (*TrappedApplicationServiceElement) GetIndicationReceived ¶
func (s *TrappedApplicationServiceElement) GetIndicationReceived() PDU
func (*TrappedApplicationServiceElement) GetRequestSent ¶
func (s *TrappedApplicationServiceElement) GetRequestSent() PDU
func (*TrappedApplicationServiceElement) GetResponseSent ¶
func (s *TrappedApplicationServiceElement) GetResponseSent() PDU
func (*TrappedApplicationServiceElement) Indication ¶
func (s *TrappedApplicationServiceElement) Indication(args Args, kwArgs KWArgs) error
func (*TrappedApplicationServiceElement) Request ¶
func (s *TrappedApplicationServiceElement) Request(args Args, kwArgs KWArgs) error
func (*TrappedApplicationServiceElement) Response ¶
func (s *TrappedApplicationServiceElement) Response(args Args, kwArgs KWArgs) error
func (*TrappedApplicationServiceElement) String ¶
func (s *TrappedApplicationServiceElement) String() string
type TrappedClient ¶
type TrappedClient struct { TrappedClientContract `ignore:"true"` ClientContract // contains filtered or unexported fields }
TrappedClient An instance of this class sits at the top of a stack.
func NewTrappedClient ¶
func NewTrappedClient(localLog zerolog.Logger, options ...Option) (*TrappedClient, error)
func (*TrappedClient) Confirmation ¶
func (t *TrappedClient) Confirmation(args Args, kwArgs KWArgs) error
func (*TrappedClient) GetConfirmationReceived ¶
func (t *TrappedClient) GetConfirmationReceived() PDU
func (*TrappedClient) GetRequestSent ¶
func (t *TrappedClient) GetRequestSent() PDU
func (*TrappedClient) Request ¶
func (t *TrappedClient) Request(args Args, kwArgs KWArgs) error
func (*TrappedClient) Serialize ¶
func (d *TrappedClient) Serialize() ([]byte, error)
func (*TrappedClient) SerializeWithWriteBuffer ¶
func (d *TrappedClient) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error
func (*TrappedClient) String ¶
func (d *TrappedClient) String() string
type TrappedClientContract ¶
type TrappedClientContract interface { utils.Serializable Request(Args, KWArgs) error Confirmation(args Args, kwArgs KWArgs) error }
TrappedClientContract provides a set of functions which can be overwritten by a sub struct
type TrappedClientStateMachine ¶
type TrappedClientStateMachine struct { *TrappedServer *TrappedStateMachine // contains filtered or unexported fields }
func NewTrappedClientStateMachine ¶
func NewTrappedClientStateMachine(localLog zerolog.Logger, options ...Option) (*TrappedClientStateMachine, error)
func (*TrappedClientStateMachine) Confirmation ¶
func (t *TrappedClientStateMachine) Confirmation(args Args, kwArgs KWArgs) error
func (*TrappedClientStateMachine) Send ¶
func (t *TrappedClientStateMachine) Send(args Args, kwArgs KWArgs) error
type TrappedServer ¶
type TrappedServer struct { TrappedServerContract `ignore:"true"` ServerContract // contains filtered or unexported fields }
TrappedServer An instance of this class sits at the bottom of a stack.
func NewTrappedServer ¶
func NewTrappedServer(localLog zerolog.Logger, options ...Option) (*TrappedServer, error)
func (*TrappedServer) GetIndicationReceived ¶
func (t *TrappedServer) GetIndicationReceived() PDU
func (*TrappedServer) GetResponseSent ¶
func (t *TrappedServer) GetResponseSent() PDU
func (*TrappedServer) Indication ¶
func (t *TrappedServer) Indication(args Args, kwArgs KWArgs) error
func (*TrappedServer) Response ¶
func (t *TrappedServer) Response(args Args, kwArgs KWArgs) error
func (*TrappedServer) Serialize ¶
func (d *TrappedServer) Serialize() ([]byte, error)
func (*TrappedServer) SerializeWithWriteBuffer ¶
func (d *TrappedServer) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error
func (*TrappedServer) String ¶
func (d *TrappedServer) String() string
type TrappedServerContract ¶
type TrappedServerContract interface { utils.Serializable Indication(args Args, kwArgs KWArgs) error Response(Args, KWArgs) error }
TrappedServerContract provides a set of functions which can be overwritten by a sub struct
type TrappedServerStateMachine ¶
type TrappedServerStateMachine struct { *TrappedServer *TrappedStateMachine // contains filtered or unexported fields }
func NewTrappedServerStateMachine ¶
func NewTrappedServerStateMachine(localLog zerolog.Logger) (*TrappedServerStateMachine, error)
func (*TrappedServerStateMachine) Indication ¶
func (t *TrappedServerStateMachine) Indication(args Args, kwArgs KWArgs) error
func (*TrappedServerStateMachine) Send ¶
func (t *TrappedServerStateMachine) Send(args Args, kwArgs KWArgs) error
type TrappedServiceAccessPoint ¶
type TrappedServiceAccessPoint struct { ServiceAccessPointContract // contains filtered or unexported fields }
TrappedServiceAccessPoint Note that while this class inherits from ServiceAccessPoint, it doesn't
provide any stubbed behavior for SapIndication() or SapConfirmation(), so if these functions are called it will still raise panic. To provide these functions, write a ServiceAccessPoint derived class and stuff it in the inheritance sequence: struct Snort{ ServiceAccessPoint } func SapIndication(pdu): ...do something... func SapConfirmation(pdu): ...do something... struct TrappedSnort(TrappedServiceAccessPoint, Snort) The Snort functions will be called after the PDU is trapped.
func NewTrappedServiceAccessPoint ¶
func NewTrappedServiceAccessPoint(localLog zerolog.Logger, requirements TrappedServiceAccessPointRequirements, options ...Option) (*TrappedServiceAccessPoint, error)
func (*TrappedServiceAccessPoint) GetSapConfirmationReceived ¶
func (s *TrappedServiceAccessPoint) GetSapConfirmationReceived() PDU
func (*TrappedServiceAccessPoint) GetSapIndicationReceived ¶
func (s *TrappedServiceAccessPoint) GetSapIndicationReceived() PDU
func (*TrappedServiceAccessPoint) GetSapRequestSent ¶
func (s *TrappedServiceAccessPoint) GetSapRequestSent() PDU
func (*TrappedServiceAccessPoint) GetSapResponseSent ¶
func (s *TrappedServiceAccessPoint) GetSapResponseSent() PDU
func (*TrappedServiceAccessPoint) SapConfirmation ¶
func (s *TrappedServiceAccessPoint) SapConfirmation(args Args, kwArgs KWArgs) error
func (*TrappedServiceAccessPoint) SapIndication ¶
func (s *TrappedServiceAccessPoint) SapIndication(args Args, kwArgs KWArgs) error
func (*TrappedServiceAccessPoint) SapRequest ¶
func (s *TrappedServiceAccessPoint) SapRequest(args Args, kwArgs KWArgs) error
func (*TrappedServiceAccessPoint) SapResponse ¶
func (s *TrappedServiceAccessPoint) SapResponse(args Args, kwArgs KWArgs) error
type TrappedState ¶
type TrappedState struct { *Trapper state_machine.State }
TrappedState This class is a simple wrapper around the state class that keeps the latest copy of the pdu parameter in the BeforeSend(), AfterSend(), BeforeReceive(), AfterReceive() and UnexpectedReceive() calls.
func NewTrappedState ¶
func NewTrappedState(state state_machine.State, trapper *Trapper) *TrappedState
func (*TrappedState) AfterReceive ¶
func (t *TrappedState) AfterReceive(pdu PDU)
func (*TrappedState) AfterSend ¶
func (t *TrappedState) AfterSend(pdu PDU)
func (*TrappedState) BeforeReceive ¶
func (t *TrappedState) BeforeReceive(pdu PDU)
func (*TrappedState) BeforeSend ¶
func (t *TrappedState) BeforeSend(pdu PDU)
func (*TrappedState) Equals ¶
func (t *TrappedState) Equals(other state_machine.State) bool
func (*TrappedState) String ¶
func (t *TrappedState) String() string
func (*TrappedState) UnexpectedReceive ¶
func (t *TrappedState) UnexpectedReceive(pdu PDU)
type TrappedStateMachine ¶
type TrappedStateMachine struct { *Trapper StateMachineContract // contains filtered or unexported fields }
TrappedStateMachine This class is a simple wrapper around the stateMachine class that keeps the
latest copy of the pdu parameter in the BeforeSend(), AfterSend(), BeforeReceive(), AfterReceive() and UnexpectedReceive() calls. It also provides a send() function, so when the machine runs it doesn't throw an exception.
func NewTrappedStateMachine ¶
func NewTrappedStateMachine(localLog zerolog.Logger, options ...Option) *TrappedStateMachine
func (*TrappedStateMachine) AfterReceive ¶
func (t *TrappedStateMachine) AfterReceive(pdu PDU)
func (*TrappedStateMachine) AfterSend ¶
func (t *TrappedStateMachine) AfterSend(pdu PDU)
func (*TrappedStateMachine) BeforeReceive ¶
func (t *TrappedStateMachine) BeforeReceive(pdu PDU)
func (*TrappedStateMachine) BeforeSend ¶
func (t *TrappedStateMachine) BeforeSend(pdu PDU)
func (*TrappedStateMachine) DecorateState ¶
func (t *TrappedStateMachine) DecorateState(state State) State
func (*TrappedStateMachine) GetSent ¶
func (t *TrappedStateMachine) GetSent() PDU
func (*TrappedStateMachine) Send ¶
func (t *TrappedStateMachine) Send(args Args, kwArgs KWArgs) error
func (*TrappedStateMachine) UnexpectedReceive ¶
func (t *TrappedStateMachine) UnexpectedReceive(pdu PDU)
type Trapper ¶
type Trapper struct { TrapperRequirements // contains filtered or unexported fields }
Trapper This class provides a set of utility functions that keeps the latest copy of the pdu parameter in the before_send(), after_send(), before_receive(), after_receive() and unexpected_receive() calls.
func NewTrapper ¶
func NewTrapper(localLog zerolog.Logger, requirements TrapperRequirements) *Trapper
func (*Trapper) AfterReceive ¶
func (t *Trapper) AfterReceive(pdu PDU)
AfterReceive is Called with PDU received after match.
func (*Trapper) AfterSend ¶
func (t *Trapper) AfterSend(pdu PDU)
AfterSend is Called after each PDU sent.
func (*Trapper) BeforeReceive ¶
func (t *Trapper) BeforeReceive(pdu PDU)
BeforeReceive is Called with each PDU received before matching.
func (*Trapper) BeforeSend ¶
func (t *Trapper) BeforeSend(pdu PDU)
BeforeSend is Called before each PDU about to be sent.
func (*Trapper) GetAfterReceivePdu ¶
func (t *Trapper) GetAfterReceivePdu() PDU
func (*Trapper) GetAfterSendPdu ¶
func (t *Trapper) GetAfterSendPdu() PDU
func (*Trapper) GetBeforeReceivePdu ¶
func (t *Trapper) GetBeforeReceivePdu() PDU
func (*Trapper) GetBeforeSendPdu ¶
func (t *Trapper) GetBeforeSendPdu() PDU
func (*Trapper) GetUnexpectedReceivePDU ¶
func (t *Trapper) GetUnexpectedReceivePDU() PDU
func (*Trapper) UnexpectedReceive ¶
func (t *Trapper) UnexpectedReceive(pdu PDU)
UnexpectedReceive is Called with PDU that did not match. Unless this is trapped by the state, the default behaviour is to fail.
type TrapperRequirements ¶
type TrapperRequirements interface { BeforeSend(pdu PDU) AfterSend(pdu PDU) BeforeReceive(pdu PDU) AfterReceive(pdu PDU) UnexpectedReceive(pdu PDU) }
Source Files
¶
- trapped_classes.go
- trapped_classes_TrappedApplicationServiceElement.go
- trapped_classes_TrappedClient.go
- trapped_classes_TrappedClientStateMachine.go
- trapped_classes_TrappedClient_plc4xgen.go
- trapped_classes_TrappedServer.go
- trapped_classes_TrappedServerStateMachine.go
- trapped_classes_TrappedServer_plc4xgen.go
- trapped_classes_TrappedServiceAccessPoint.go
- trapped_classes_TrappedState.go
- trapped_classes_TrappedStateMachine.go
- trapped_classes_Trapper.go