trapped_classes

package
v0.0.0-...-0b1a56d Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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

type TrappedApplicationServiceElementRequirements

type TrappedApplicationServiceElementRequirements interface {
	Indication(args Args, kwArgs KWArgs) error
	Confirmation(args Args, kwArgs KWArgs) error
}

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 TrappedServiceAccessPointRequirements

type TrappedServiceAccessPointRequirements interface {
	SapIndication(args Args, kwArgs KWArgs) error
	SapConfirmation(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)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳