session

package
v0.0.0-...-3192b2a Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalUnencrypted = iota
	GlobalEncrypted
	CounterTypeSession
)
View Source
const InitialSyncValue uint32 = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseImpl

type BaseImpl struct {
	*lib.ReferenceCounted
	// contains filtered or unexported fields
}

func (*BaseImpl) AddHolder

func (s *BaseImpl) AddHolder(holder Holder)

func (*BaseImpl) DispatchSessionEvent

func (s *BaseImpl) DispatchSessionEvent(event DelegateEvent)

func (*BaseImpl) FabricIndex

func (s *BaseImpl) FabricIndex() lib.FabricIndex

func (*BaseImpl) IsGroup

func (s *BaseImpl) IsGroup() bool

func (*BaseImpl) IsSecure

func (s *BaseImpl) IsSecure() bool

func (*BaseImpl) LogValue

func (s *BaseImpl) LogValue() log.Value

func (*BaseImpl) NotifySessionReleased

func (s *BaseImpl) NotifySessionReleased()

func (*BaseImpl) RemoveHolder

func (s *BaseImpl) RemoveHolder(holder Holder)

func (*BaseImpl) Type

func (s *BaseImpl) Type() Type

type Delegate

type Delegate interface {
	OnSessionReleased()
}

type DelegateEvent

type DelegateEvent func()

type ErrorType

type ErrorType string
var ErrorMessageCounterExhausted ErrorType = "MessageCounterExhausted"

func (ErrorType) Error

func (e ErrorType) Error() string

type GlobalUnencryptedMessageCounter

type GlobalUnencryptedMessageCounter struct {
	LastUsedValue uint32
}

func NewGlobalUnencryptedMessageCounter

func NewGlobalUnencryptedMessageCounter() *GlobalUnencryptedMessageCounter

func (GlobalUnencryptedMessageCounter) AdvanceAndConsume

func (g GlobalUnencryptedMessageCounter) AdvanceAndConsume() (uint32, error)

func (GlobalUnencryptedMessageCounter) Type

type Holder

type Holder interface {
	DispatchSessionEvent(DelegateEvent)
}

type IncomingGroupSession

type IncomingGroupSession struct {
	*BaseImpl
	// contains filtered or unexported fields
}

func NewIncomingGroupSession

func NewIncomingGroupSession(groupId lib.GroupId, index lib.FabricIndex, nodeId lib.NodeId) *IncomingGroupSession

func (*IncomingGroupSession) AckTimeout

func (i *IncomingGroupSession) AckTimeout() time.Duration

func (*IncomingGroupSession) ClearValue

func (i *IncomingGroupSession) ClearValue()

func (*IncomingGroupSession) ComputeRoundTripTimeout

func (i *IncomingGroupSession) ComputeRoundTripTimeout(upperlayerProcessingTimeout time.Duration) time.Duration

func (*IncomingGroupSession) GetPeer

func (i *IncomingGroupSession) GetPeer() lib.ScopedNodeId

func (*IncomingGroupSession) IsActive

func (i *IncomingGroupSession) IsActive() bool

func (*IncomingGroupSession) IsEstablishing

func (i *IncomingGroupSession) IsEstablishing() bool

func (*IncomingGroupSession) Released

func (i *IncomingGroupSession) Released()

func (*IncomingGroupSession) RemoteMRPConfig

func (*IncomingGroupSession) RequireMRP

func (i *IncomingGroupSession) RequireMRP() bool

type LocalMessageCounter

type LocalMessageCounter struct {
	LastUsedValue uint32
}

func NewLocalMessageCounter

func NewLocalMessageCounter() *LocalMessageCounter

func (LocalMessageCounter) AdvanceAndConsume

func (l LocalMessageCounter) AdvanceAndConsume() (uint32, error)

func (LocalMessageCounter) Type

type MessageCounter

type MessageCounter struct {
	MessageCounter     *LocalMessageCounter
	PeerMessageCounter *PeerMessageCounter
}

type MessageCounterBase

type MessageCounterBase interface {
	AdvanceAndConsume() (uint32, error)
	Type() MessageCounterType
}

type MessageCounterType

type MessageCounterType uint8

type OptionalFunc

type OptionalFunc func(*Secure)

func WithFabricIndex

func WithFabricIndex(index lib.FabricIndex) OptionalFunc

func WithLocalNodeId

func WithLocalNodeId(localNodeId lib.NodeId) OptionalFunc

func WithPeerCATs

func WithPeerCATs(peerCATs *lib.CATValues) OptionalFunc

func WithPeerNodeId

func WithPeerNodeId(peerNodeId lib.NodeId) OptionalFunc

func WithPeerSessionId

func WithPeerSessionId(peerSessionId uint16) OptionalFunc

type OutgoingGroup

type OutgoingGroup struct {
	*BaseImpl
	// contains filtered or unexported fields
}

func NewOutgoingGroupSession

func NewOutgoingGroupSession(groupId lib.GroupId, index lib.FabricIndex) *OutgoingGroup

func (*OutgoingGroup) AckTimeout

func (o *OutgoingGroup) AckTimeout() time.Duration

func (*OutgoingGroup) ClearValue

func (o *OutgoingGroup) ClearValue()

func (*OutgoingGroup) ComputeRoundTripTimeout

func (o *OutgoingGroup) ComputeRoundTripTimeout(upperlayerProcessingTimeout time.Duration) time.Duration

func (*OutgoingGroup) GetPeer

func (o *OutgoingGroup) GetPeer() lib.ScopedNodeId

func (*OutgoingGroup) GroupId

func (o *OutgoingGroup) GroupId() lib.GroupId

func (*OutgoingGroup) IsActive

func (o *OutgoingGroup) IsActive() bool

func (*OutgoingGroup) IsEstablishing

func (o *OutgoingGroup) IsEstablishing() bool

func (*OutgoingGroup) Released

func (o *OutgoingGroup) Released()

func (*OutgoingGroup) RemoteMRPConfig

func (*OutgoingGroup) RequireMRP

func (o *OutgoingGroup) RequireMRP() bool

type PeerMessageCounter

type PeerMessageCounter struct {
	// contains filtered or unexported fields
}

func NewPeerMessageCounter

func NewPeerMessageCounter() *PeerMessageCounter

func (*PeerMessageCounter) CommitGroup

func (c *PeerMessageCounter) CommitGroup(counter uint32)

func (*PeerMessageCounter) CommitUnencrypted

func (c *PeerMessageCounter) CommitUnencrypted(counter uint32)

func (*PeerMessageCounter) CommitUnencryptedUnicast

func (c *PeerMessageCounter) CommitUnencryptedUnicast(counter uint32)

func (*PeerMessageCounter) SetCounter

func (c *PeerMessageCounter) SetCounter(counter uint32)

func (*PeerMessageCounter) VerifyEncryptedUnicast

func (c *PeerMessageCounter) VerifyEncryptedUnicast(counter uint32) error

func (*PeerMessageCounter) VerifyGroup

func (c *PeerMessageCounter) VerifyGroup(counter uint32) error

func (*PeerMessageCounter) VerifyOrTrustFirstGroup

func (c *PeerMessageCounter) VerifyOrTrustFirstGroup(counter uint32) error

func (*PeerMessageCounter) VerifyPositionEncrypted

func (c *PeerMessageCounter) VerifyPositionEncrypted(pos position, counter uint32) error

func (*PeerMessageCounter) VerifyPositionUnencrypted

func (c *PeerMessageCounter) VerifyPositionUnencrypted(pos position, counter uint32) error

func (*PeerMessageCounter) VerifyUnencrypted

func (c *PeerMessageCounter) VerifyUnencrypted(counter uint32) error

type Role

type Role uint8
const (
	RoleInitiator Role = iota
	RoleResponder
)

func (Role) String

func (t Role) String() string

func (Role) Uint8

func (t Role) Uint8() uint8

type Secure

type Secure struct {
	*BaseImpl
	// contains filtered or unexported fields
}

func NewSecure

func NewSecure(
	table SecureDelegate,
	secureSessionType SecureType,
	localSessionId uint16,
	options ...OptionalFunc,
) *Secure

func (*Secure) AckTimeout

func (s *Secure) AckTimeout() time.Duration

func (*Secure) Activate

func (s *Secure) Activate(local, peer lib.ScopedNodeId, ts lib.CATValues, peerSessionId uint16, config *messageing.ReliableMessageProtocolConfig)

func (*Secure) ClearValue

func (s *Secure) ClearValue()

func (*Secure) ComputeRoundTripTimeout

func (s *Secure) ComputeRoundTripTimeout(upperlayerProcessingTimeout time.Duration) time.Duration

func (*Secure) GetCryptoContext

func (s *Secure) GetCryptoContext() *transport.CryptoContext

func (*Secure) GetPeer

func (s *Secure) GetPeer() lib.ScopedNodeId

func (*Secure) IsActive

func (s *Secure) IsActive() bool

func (*Secure) IsCASESession

func (s *Secure) IsCASESession() bool

func (*Secure) IsDefunct

func (s *Secure) IsDefunct() bool

func (*Secure) IsEstablishing

func (s *Secure) IsEstablishing() bool

func (*Secure) IsPendingEviction

func (s *Secure) IsPendingEviction() bool

func (*Secure) LocalSessionId

func (s *Secure) LocalSessionId() uint16

func (*Secure) MarkActive

func (s *Secure) MarkActive()

func (*Secure) MarkActiveRx

func (s *Secure) MarkActiveRx()

func (*Secure) MarkAsDefunct

func (s *Secure) MarkAsDefunct()

MarkAsDefunct 标记为失效

func (*Secure) MarkForEviction

func (s *Secure) MarkForEviction()

func (*Secure) MoveToState

func (s *Secure) MoveToState(targetState State)

func (*Secure) Name

func (s *Secure) Name() string

func (*Secure) PeerAddress

func (s *Secure) PeerAddress() raw.PeerAddress

func (*Secure) PeerNodeId

func (s *Secure) PeerNodeId() lib.NodeId

func (*Secure) Released

func (s *Secure) Released()

func (*Secure) RemoteMRPConfig

func (s *Secure) RemoteMRPConfig() *messageing.ReliableMessageProtocolConfig

func (*Secure) RequireMRP

func (s *Secure) RequireMRP() bool

func (*Secure) SecureType

func (s *Secure) SecureType() SecureType

func (*Secure) SessionMessageCounter

func (s *Secure) SessionMessageCounter() MessageCounter

func (*Secure) SetPeerAddress

func (s *Secure) SetPeerAddress(address raw.PeerAddress)

func (*Secure) State

func (s *Secure) State() State

type SecureDelegate

type SecureDelegate interface {
	ReleaseSession(secure *Secure)
}

type SecureType

type SecureType uint8
const (
	SecureTypePASE SecureType = iota
	SecureTypeCASE
)

func (SecureType) String

func (t SecureType) String() string

type Session

type Session interface {
	Retain()
	Release()
	IsActive() bool
	IsEstablishing() bool
	AckTimeout() time.Duration
	GetPeer() lib.ScopedNodeId
	ComputeRoundTripTimeout(duration time.Duration) time.Duration
	RemoteMRPConfig() *messageing.ReliableMessageProtocolConfig
	RequireMRP() bool
	Released()
	ClearValue()
	AddHolder(handle Holder)
	RemoveHolder(holder Holder)
	FabricIndex() lib.FabricIndex
	NotifySessionReleased()
	DispatchSessionEvent(delegate DelegateEvent)
	IsSecure() bool
	IsGroup() bool
	Type() Type
}

type State

type State uint8

func (State) String

func (t State) String() string

type SyncInProcess

type SyncInProcess struct {
	// contains filtered or unexported fields
}

type Synced

type Synced struct {
	// contains filtered or unexported fields
}

type Type

type Type uint8
const (
	TypeUndefined Type = iota
	TypeUnauthenticated
	TypeSecure
	TypeGroupIncoming
	TypeGroupOutgoing
)

func (Type) String

func (t Type) String() string

type Unauthenticated

type Unauthenticated struct {
	*BaseImpl
	// contains filtered or unexported fields
}

func NewUnauthenticated

func NewUnauthenticated(roleResponder Role, ephemeralInitiatorNodeID lib.NodeId, config *messageing.ReliableMessageProtocolConfig) *Unauthenticated

func (*Unauthenticated) AckTimeout

func (s *Unauthenticated) AckTimeout() time.Duration

func (*Unauthenticated) ClearValue

func (s *Unauthenticated) ClearValue()

func (*Unauthenticated) ComputeRoundTripTimeout

func (s *Unauthenticated) ComputeRoundTripTimeout(upperlayerProcessingTimeout time.Duration) time.Duration

func (*Unauthenticated) DispatchSessionEvent

func (s *Unauthenticated) DispatchSessionEvent(delegate DelegateEvent)

func (*Unauthenticated) EphemeralInitiatorNodeId

func (s *Unauthenticated) EphemeralInitiatorNodeId() lib.NodeId

func (*Unauthenticated) GetPeer

func (s *Unauthenticated) GetPeer() lib.ScopedNodeId

func (*Unauthenticated) IsActive

func (s *Unauthenticated) IsActive() bool

func (*Unauthenticated) IsEstablishing

func (s *Unauthenticated) IsEstablishing() bool

func (*Unauthenticated) LastActivityTime

func (s *Unauthenticated) LastActivityTime() time.Time

func (*Unauthenticated) LastPeerActivityTime

func (s *Unauthenticated) LastPeerActivityTime() time.Time

func (*Unauthenticated) MarkActive

func (s *Unauthenticated) MarkActive()

func (*Unauthenticated) MarkActiveRx

func (s *Unauthenticated) MarkActiveRx()

func (*Unauthenticated) PeerAddress

func (s *Unauthenticated) PeerAddress() raw.PeerAddress

func (*Unauthenticated) PeerMessageCounter

func (s *Unauthenticated) PeerMessageCounter() *PeerMessageCounter

func (*Unauthenticated) PeerNodeId

func (s *Unauthenticated) PeerNodeId() lib.NodeId

func (*Unauthenticated) Released

func (s *Unauthenticated) Released()

func (*Unauthenticated) RemoteMRPConfig

func (*Unauthenticated) RequireMRP

func (s *Unauthenticated) RequireMRP() bool

func (*Unauthenticated) Role

func (s *Unauthenticated) Role() Role

func (*Unauthenticated) SessionReleased

func (s *Unauthenticated) SessionReleased()

func (*Unauthenticated) SetPeerAddress

func (s *Unauthenticated) SetPeerAddress(addr netip.AddrPort)

func (*Unauthenticated) SetRemoteMRPConfig

func (s *Unauthenticated) SetRemoteMRPConfig(config *messageing.ReliableMessageProtocolConfig)

Jump to

Keyboard shortcuts

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