Documentation
¶
Overview ¶
Package sccp provides encoding/decoding feature of Signalling Connection Control Part used in SS7/SIGTRAN protocol stack.
This is still an experimental project, and currently in its very early stage of development. Any part of implementations (including exported APIs) may be changed before released as v1.0.0.
Index ¶
- Variables
- func DecodeSequenceNumber(encoded uint8) uint8
- func DisableLogging()
- func EnableLogging(l *log.Logger)
- func EncodeSequenceNumber(n uint8) uint8
- func SetLogger(l *log.Logger)
- type AK
- type CC
- type CR
- type CREF
- type ConnectionSection
- func (s *ConnectionSection) HandleAcknowledgement(acknowledgement *AK) error
- func (s *ConnectionSection) HandleConnectionConfirm(confirm *CC) error
- func (s *ConnectionSection) HandleConnectionRefused(refusal *CREF) error
- func (s *ConnectionSection) HandleDataForm1(data *DT1) (DataIndication, error)
- func (s *ConnectionSection) HandleDataForm2(data *DT2) (DataIndication, error)
- func (s *ConnectionSection) HandleReleaseComplete(complete *RLC) error
- func (s *ConnectionSection) HandleReleased(released *RLSD) (*RLC, error)
- func (s *ConnectionSection) Release(cause params.ReleaseCauseValue, opts ...params.Parameter) (*RLSD, error)
- func (s *ConnectionSection) SendData(data []byte, moreData bool) (Message, error)
- type ConnectionState
- type DT1
- type DT2
- type DataIndication
- type EA
- type ED
- type ERR
- type IT
- type LUDT
- func (l *LUDT) CdGT() string
- func (l *LUDT) CgGT() string
- func (l *LUDT) MarshalBinary() ([]byte, error)
- func (l *LUDT) MarshalLen() int
- func (l *LUDT) MarshalTo(b []byte) error
- func (l *LUDT) MessageType() MsgType
- func (l *LUDT) MessageTypeName() string
- func (l *LUDT) String() string
- func (l *LUDT) UnmarshalBinary(b []byte) error
- type LUDTS
- func (l *LUDTS) CdGT() string
- func (l *LUDTS) CgGT() string
- func (l *LUDTS) MarshalBinary() ([]byte, error)
- func (l *LUDTS) MarshalLen() int
- func (l *LUDTS) MarshalTo(b []byte) error
- func (l *LUDTS) MessageType() MsgType
- func (l *LUDTS) MessageTypeName() string
- func (l *LUDTS) String() string
- func (l *LUDTS) UnmarshalBinary(b []byte) error
- type Message
- type MsgType
- type NoticeIndication
- type RLC
- type RLSD
- type RSC
- type RSR
- type SCMG
- type SCMGType
- type Stack
- func (s *Stack) Connection(localReference uint32) (ConnectionSection, bool)
- func (s *Stack) HandleMessage(message Message) (StackResult, error)
- func (s *Stack) NewConnectionRequest(protocolClass int, returnOnError bool, credit uint8, ...) (*CR, uint32, error)
- func (s *Stack) RegisterSubsystem(ssn uint8)
- func (s *Stack) ReleaseConnection(localReference uint32, cause params.ReleaseCauseValue, ...) (*RLSD, error)
- func (s *Stack) SubsystemAvailable(ssn uint8) bool
- func (s *Stack) UnregisterSubsystem(ssn uint8)
- type StackConfig
- type StackResult
- type UDT
- func (u *UDT) CdGT() string
- func (u *UDT) CgGT() string
- func (u *UDT) MarshalBinary() ([]byte, error)
- func (u *UDT) MarshalLen() int
- func (u *UDT) MarshalTo(b []byte) error
- func (u *UDT) MessageType() MsgType
- func (u *UDT) MessageTypeName() string
- func (u *UDT) String() string
- func (u *UDT) UnmarshalBinary(b []byte) error
- type UDTS
- func (u *UDTS) CdGT() string
- func (u *UDTS) CgGT() string
- func (u *UDTS) MarshalBinary() ([]byte, error)
- func (u *UDTS) MarshalLen() int
- func (u *UDTS) MarshalTo(b []byte) error
- func (u *UDTS) MessageType() MsgType
- func (u *UDTS) MessageTypeName() string
- func (u *UDTS) String() string
- func (u *UDTS) UnmarshalBinary(b []byte) error
- type UnitdataIndication
- type UnsupportedTypeError
- type XUDT
- func (x *XUDT) CdGT() string
- func (x *XUDT) CgGT() string
- func (x *XUDT) MarshalBinary() ([]byte, error)
- func (x *XUDT) MarshalLen() int
- func (x *XUDT) MarshalTo(b []byte) error
- func (x *XUDT) MessageType() MsgType
- func (x *XUDT) MessageTypeName() string
- func (x *XUDT) String() string
- func (x *XUDT) UnmarshalBinary(b []byte) error
- type XUDTS
- func (x *XUDTS) CdGT() string
- func (x *XUDTS) CgGT() string
- func (x *XUDTS) MarshalBinary() ([]byte, error)
- func (x *XUDTS) MarshalLen() int
- func (x *XUDTS) MarshalTo(b []byte) error
- func (x *XUDTS) MessageType() MsgType
- func (x *XUDTS) MessageTypeName() string
- func (x *XUDTS) String() string
- func (x *XUDTS) UnmarshalBinary(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidConnectionState reports a Q.714 procedure invoked in the wrong state. ErrInvalidConnectionState = errors.New("sccp: invalid connection state") // ErrReferenceMismatch reports a message that does not address this connection section. ErrReferenceMismatch = errors.New("sccp: connection reference mismatch") // ErrFlowControlBlocked reports that class 3 flow control does not authorize more DT2 transfer. ErrFlowControlBlocked = errors.New("sccp: flow control blocked") // ErrSequenceMismatch reports a class 3 sequence number outside the valid send or receive window. ErrSequenceMismatch = errors.New("sccp: sequence mismatch") // ErrInvalidCredit reports a class 3 credit outside the Q.714 window-size range. ErrInvalidCredit = errors.New("sccp: invalid credit") )
var ( // ErrConnectionNotFound reports a connection-oriented message for an unknown local reference. ErrConnectionNotFound = errors.New("sccp: connection not found") // ErrLocalReferenceExhausted reports that no non-frozen local reference can be allocated. ErrLocalReferenceExhausted = errors.New("sccp: local reference exhausted") // ErrInvalidStackMessage reports a message missing fields required by SCCP stack procedures. ErrInvalidStackMessage = errors.New("sccp: invalid stack message") )
Functions ¶
func DecodeSequenceNumber ¶
DecodeSequenceNumber returns the decoded modulo-128 value from a Q.713 sequence-number octet.
func DisableLogging ¶
func DisableLogging()
DisableLogging disables the logging from the package. Logging is enabled by default.
func EnableLogging ¶
EnableLogging enables the logging from the package. If l is nil, it uses default logger provided by the package. Logging is enabled by default.
See also: SetLogger.
func EncodeSequenceNumber ¶
EncodeSequenceNumber returns the Q.713 sequence-number octet for a decoded modulo-128 value.
func SetLogger ¶
SetLogger replaces the standard logger with arbitrary *log.Logger.
This package prints just informational logs from goroutines working background that might help developers test the program but can be ignored safely. More important ones that needs any action by caller would be returned as errors.
Types ¶
type AK ¶
type AK struct {
Type MsgType
DestinationLocalReference *params.LocalReference
ReceiveSequenceNumber *params.ReceiveSequenceNumber
Credit *params.Credit
}
AK represents an SCCP Data Acknowledgement message; see ITU-T Q.713 (03/01), section 4.9.
func (*AK) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from an AK instance.
func (*AK) MessageType ¶
MessageType returns the Message Type in int.
func (*AK) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*AK) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP AK.
type CC ¶
type CC struct {
Type MsgType
DestinationLocalReference *params.LocalReference
SourceLocalReference *params.LocalReference
ProtocolClass *params.ProtocolClass
Credit *params.Credit
CalledPartyAddress *params.PartyAddress
Data *params.Data
Importance *params.Importance
EndOfOptionalParameters *params.EndOfOptionalParameters
// contains filtered or unexported fields
}
CC represents an SCCP Connection Confirm message; see ITU-T Q.713 (03/01), section 4.3.
func (*CC) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a CC instance.
func (*CC) MessageType ¶
MessageType returns the Message Type in int.
func (*CC) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*CC) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP CC.
type CR ¶
type CR struct {
Type MsgType
SourceLocalReference *params.LocalReference
ProtocolClass *params.ProtocolClass
CalledPartyAddress *params.PartyAddress
Credit *params.Credit
CallingPartyAddress *params.PartyAddress
Data *params.Data
HopCounter *params.HopCounter
Importance *params.Importance
EndOfOptionalParameters *params.EndOfOptionalParameters
// contains filtered or unexported fields
}
CR represents an SCCP Connection Request message; see ITU-T Q.713 (03/01), section 4.2.
func NewCR ¶
func NewCR(src uint32, pcls int, retOnErr bool, cdpa *params.PartyAddress, opts ...params.Parameter) *CR
NewCR creates a new CR.
func (*CR) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a CR instance.
func (*CR) MessageType ¶
MessageType returns the Message Type in int.
func (*CR) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*CR) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP CR.
type CREF ¶
type CREF struct {
Type MsgType
DestinationLocalReference *params.LocalReference
RefusalCause *params.RefusalCause
CalledPartyAddress *params.PartyAddress
Data *params.Data
Importance *params.Importance
EndOfOptionalParameters *params.EndOfOptionalParameters
// contains filtered or unexported fields
}
CREF represents an SCCP Connection Refused message; see ITU-T Q.713 (03/01), section 4.4.
func (*CREF) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a CREF instance.
func (*CREF) MessageType ¶
MessageType returns the Message Type in int.
func (*CREF) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*CREF) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP CREF.
type ConnectionSection ¶
type ConnectionSection struct {
LocalReference uint32
RemoteReference uint32
ProtocolClass int
Credit uint8
SendCredit uint8
State ConnectionState
SendSequenceNumber uint8
ReceiveSequenceNumber uint8
SendWindowLowerEdge uint8
ReceiveWindowLowerEdge uint8
// contains filtered or unexported fields
}
ConnectionSection stores the local state for one SCCP connection section.
ITU-T Q.714 (05/01), section 3.1.2 assigns local reference numbers independently at each end and makes the destination reference mandatory once known. Section 3.3.2 requires released local references to remain frozen before reuse; this helper keeps the reference visible while State is frozen.
func NewEstablishedConnectionSection ¶
func NewEstablishedConnectionSection(localReference, remoteReference uint32, protocolClass int, credit uint8) *ConnectionSection
NewEstablishedConnectionSection creates a section whose two local references are known.
func NewPendingConnectionSection ¶
func NewPendingConnectionSection(localReference uint32, protocolClass int, credit uint8) *ConnectionSection
NewPendingConnectionSection creates an originating section after CR transfer.
ITU-T Q.714 (05/01), section 3.1.4.1 assigns the source local reference, proposed protocol class, and initial credit before starting T(conn est).
func (*ConnectionSection) HandleAcknowledgement ¶
func (s *ConnectionSection) HandleAcknowledgement(acknowledgement *AK) error
HandleAcknowledgement applies class 3 AK receive procedures.
ITU-T Q.714 (05/01), section 3.5.2.4.3 uses P(R) in AK to set the lower edge of the sender window, and section 3.5.2.4.2 uses AK credit zero to stop DT2 transfer until a later positive-credit AK or reset.
func (*ConnectionSection) HandleConnectionConfirm ¶
func (s *ConnectionSection) HandleConnectionConfirm(confirm *CC) error
HandleConnectionConfirm applies a CC to a pending originating section.
ITU-T Q.714 (05/01), section 3.1.4.2 associates the received local reference with the section, updates the assigned protocol class and credit, and establishes the connection section.
func (*ConnectionSection) HandleConnectionRefused ¶
func (s *ConnectionSection) HandleConnectionRefused(refusal *CREF) error
HandleConnectionRefused applies a CREF to a pending originating section.
ITU-T Q.714 (05/01), sections 3.1.4.2 and 3.2.3 release the resources for the failed setup and freeze the local reference.
func (*ConnectionSection) HandleDataForm1 ¶
func (s *ConnectionSection) HandleDataForm1(data *DT1) (DataIndication, error)
HandleDataForm1 applies class 2 DT1 receive procedures and returns the local data indication.
ITU-T Q.714 (05/01), sections 3.5.1.3 and 3.5.3 deliver complete or segmented user data to the destination SCCP user according to the M-bit.
func (*ConnectionSection) HandleDataForm2 ¶
func (s *ConnectionSection) HandleDataForm2(data *DT2) (DataIndication, error)
HandleDataForm2 applies class 3 DT2 receive, acknowledgement, and window procedures.
ITU-T Q.714 (05/01), sections 3.5.2.4.1 and 3.5.2.4.3 require DT2 P(S) to be the next expected modulo-128 sequence number and P(R) to advance within the sender's outstanding window. Section 3.5.2.4.2 requires AK generation at the receiving upper window edge when no DT2 is available for piggybacking.
func (*ConnectionSection) HandleReleaseComplete ¶
func (s *ConnectionSection) HandleReleaseComplete(complete *RLC) error
HandleReleaseComplete applies an RLC received after local release initiation.
ITU-T Q.714 (05/01), section 3.3.3.2 completes release by freeing resources, stopping T(rel), and freezing the local reference.
func (*ConnectionSection) HandleReleased ¶
func (s *ConnectionSection) HandleReleased(released *RLSD) (*RLC, error)
HandleReleased applies an incoming RLSD and returns the RLC response.
ITU-T Q.714 (05/01), sections 3.3.3.2 and 3.3.5 require release completion and reference freezing when RLSD is received. Section 3.8.2.2 specifies RLC with reversed local reference numbers for an RLSD containing both references.
func (*ConnectionSection) Release ¶
func (s *ConnectionSection) Release(cause params.ReleaseCauseValue, opts ...params.Parameter) (*RLSD, error)
Release starts end-node connection release and returns the RLSD to transfer.
ITU-T Q.714 (05/01), section 3.3.3.1 initiates release by sending RLSD and starting T(rel). Timer ownership is intentionally left to the caller.
func (*ConnectionSection) SendData ¶
func (s *ConnectionSection) SendData(data []byte, moreData bool) (Message, error)
SendData applies Q.714 data-transfer procedures and returns the DT message to transfer.
ITU-T Q.714 (05/01), section 3.5.1 uses DT1 for basic class 2 data transfer. Sections 3.5.2.1 through 3.5.2.4 apply modulo-128 DT2 sequence numbering and per-direction flow-control windows to class 3 only.
type ConnectionState ¶
type ConnectionState uint8
ConnectionState identifies the local procedure state of a connection section.
const ( ConnectionStateIdle ConnectionState = iota ConnectionStatePending ConnectionStateEstablished ConnectionStateReleasePending ConnectionStateFrozen )
Connection section states used by the Q.714 procedure helpers.
func (ConnectionState) String ¶
func (s ConnectionState) String() string
String returns the connection state name.
type DT1 ¶
type DT1 struct {
Type MsgType
DestinationLocalReference *params.LocalReference
SegmentingReassembling *params.SegmentingReassembling
Data *params.Data
// contains filtered or unexported fields
}
DT1 represents an SCCP Data Form 1 message; see ITU-T Q.713 (03/01), section 4.7.
func (*DT1) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a DT1 instance.
func (*DT1) MessageType ¶
MessageType returns the Message Type in int.
func (*DT1) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*DT1) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP DT1.
type DT2 ¶
type DT2 struct {
Type MsgType
DestinationLocalReference *params.LocalReference
SequencingSegmenting *params.SequencingSegmenting
Data *params.Data
// contains filtered or unexported fields
}
DT2 represents an SCCP Data Form 2 message; see ITU-T Q.713 (03/01), section 4.8.
func (*DT2) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a DT2 instance.
func (*DT2) MessageType ¶
MessageType returns the Message Type in int.
func (*DT2) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*DT2) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP DT2.
type DataIndication ¶
type DataIndication struct {
Message Message
LocalReference uint32
RemoteReference uint32
ProtocolClass int
MoreData bool
Data []byte
Acknowledgement *AK
}
DataIndication represents an N-DATA indication delivered to a local SCCP user.
type EA ¶
type EA struct {
Type MsgType
DestinationLocalReference *params.LocalReference
}
EA represents an SCCP Expedited Data Acknowledgement message; see ITU-T Q.713 (03/01), section 4.13.
func (*EA) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from an EA instance.
func (*EA) MessageType ¶
MessageType returns the Message Type in int.
func (*EA) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*EA) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP EA.
type ED ¶
type ED struct {
Type MsgType
DestinationLocalReference *params.LocalReference
Data *params.Data
// contains filtered or unexported fields
}
ED represents an SCCP Expedited Data message; see ITU-T Q.713 (03/01), section 4.12.
func (*ED) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from an ED instance.
func (*ED) MessageType ¶
MessageType returns the Message Type in int.
func (*ED) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*ED) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP ED.
type ERR ¶
type ERR struct {
Type MsgType
DestinationLocalReference *params.LocalReference
ErrorCause *params.ErrorCause
OptionalParameters []params.Parameter
// contains filtered or unexported fields
}
ERR represents an SCCP Protocol Data Unit Error message; see ITU-T Q.713 (03/01), section 4.16.
func (*ERR) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from an ERR instance.
func (*ERR) MessageType ¶
MessageType returns the Message Type in int.
func (*ERR) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*ERR) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP ERR.
type IT ¶
type IT struct {
Type MsgType
DestinationLocalReference *params.LocalReference
SourceLocalReference *params.LocalReference
ProtocolClass *params.ProtocolClass
SequencingSegmenting *params.SequencingSegmenting
Credit *params.Credit
}
IT represents an SCCP Inactivity Test message; see ITU-T Q.713 (03/01), section 4.17.
func NewIT ¶
func NewIT(dst, src uint32, pcls int, retOnErr bool, snd, rcv uint8, moreData bool, credit uint8) *IT
NewIT creates a new IT.
func (*IT) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from an IT instance.
func (*IT) MessageType ¶
MessageType returns the Message Type in int.
func (*IT) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*IT) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP IT.
type LUDT ¶
type LUDT struct {
Type MsgType
ProtocolClass *params.ProtocolClass
HopCounter *params.HopCounter
CalledPartyAddress *params.PartyAddress
CallingPartyAddress *params.PartyAddress
LongData *params.LongData
Segmentation *params.Segmentation
Importance *params.Importance
EndOfOptionalParameters *params.EndOfOptionalParameters
// contains filtered or unexported fields
}
LUDT represents an SCCP Long Unitdata message; see ITU-T Q.713 (03/01), section 4.20.
func NewLUDT ¶
func NewLUDT(pcls int, retOnErr bool, hc uint8, cdpa, cgpa *params.PartyAddress, data []byte, opts ...params.Parameter) *LUDT
NewLUDT creates a new LUDT.
func (*LUDT) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a LUDT instance.
func (*LUDT) MessageType ¶
MessageType returns the Message Type in int.
func (*LUDT) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*LUDT) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP LUDT.
type LUDTS ¶
type LUDTS struct {
Type MsgType
ReturnCause *params.ReturnCause
HopCounter *params.HopCounter
CalledPartyAddress *params.PartyAddress
CallingPartyAddress *params.PartyAddress
LongData *params.LongData
Segmentation *params.Segmentation
Importance *params.Importance
EndOfOptionalParameters *params.EndOfOptionalParameters
// contains filtered or unexported fields
}
LUDTS represents an SCCP Long Unitdata Service message; see ITU-T Q.713 (03/01), section 4.21.
func NewLUDTS ¶
func NewLUDTS(rc params.ReturnCauseValue, hc uint8, cdpa, cgpa *params.PartyAddress, data []byte, opts ...params.Parameter) *LUDTS
NewLUDTS creates a new LUDTS.
func ParseLUDTS ¶
ParseLUDTS decodes given byte sequence as a SCCP LUDTS.
func (*LUDTS) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a LUDTS instance.
func (*LUDTS) MessageType ¶
MessageType returns the Message Type in int.
func (*LUDTS) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*LUDTS) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP LUDTS.
type Message ¶
type Message interface {
encoding.BinaryMarshaler
encoding.BinaryUnmarshaler
MarshalTo([]byte) error
MarshalLen() int
MessageType() MsgType
MessageTypeName() string
fmt.Stringer
}
Message is an interface that defines SCCP messages.
func ParseMessage ¶
ParseMessage decodes the byte sequence into Message by Message Type.
type MsgType ¶
type MsgType uint8
MsgType is type of SCCP message.
const ( MsgTypeCR MsgType // CR MsgTypeCC // CC MsgTypeCREF // CREF MsgTypeRLSD // RLSD MsgTypeRLC // RLC MsgTypeDT1 // DT1 MsgTypeDT2 // DT2 MsgTypeAK // AK MsgTypeUDT // UDT MsgTypeUDTS // UDTS MsgTypeED // ED MsgTypeEA // EA MsgTypeRSR // RSR MsgTypeRSC // RSC MsgTypeERR // ERR MsgTypeIT // IT MsgTypeXUDT // XUDT MsgTypeXUDTS // XUDTS MsgTypeLUDT // LUDT MsgTypeLUDTS // LUDTS )
Message Type definitions.
type NoticeIndication ¶
type NoticeIndication struct {
Message Message
ReturnCause params.ReturnCauseValue
CalledPartyAddress *params.PartyAddress
CallingPartyAddress *params.PartyAddress
Data []byte
}
NoticeIndication represents an N-NOTICE indication for a received service message.
type RLC ¶
type RLC struct {
Type MsgType
DestinationLocalReference *params.LocalReference
SourceLocalReference *params.LocalReference
}
RLC represents an SCCP Release Complete message; see ITU-T Q.713 (03/01), section 4.6.
func (*RLC) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a RLC instance.
func (*RLC) MessageType ¶
MessageType returns the Message Type in int.
func (*RLC) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*RLC) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP RLC.
type RLSD ¶
type RLSD struct {
Type MsgType
DestinationLocalReference *params.LocalReference
SourceLocalReference *params.LocalReference
ReleaseCause *params.ReleaseCause
Data *params.Data
Importance *params.Importance
EndOfOptionalParameters *params.EndOfOptionalParameters
// contains filtered or unexported fields
}
RLSD represents an SCCP Released message; see ITU-T Q.713 (03/01), section 4.5.
func (*RLSD) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a RLSD instance.
func (*RLSD) MessageType ¶
MessageType returns the Message Type in int.
func (*RLSD) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*RLSD) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP RLSD.
type RSC ¶
type RSC struct {
Type MsgType
DestinationLocalReference *params.LocalReference
SourceLocalReference *params.LocalReference
}
RSC represents an SCCP Reset Confirmation message; see ITU-T Q.713 (03/01), section 4.15.
func (*RSC) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a RSC instance.
func (*RSC) MessageType ¶
MessageType returns the Message Type in int.
func (*RSC) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*RSC) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP RSC.
type RSR ¶
type RSR struct {
Type MsgType
DestinationLocalReference *params.LocalReference
SourceLocalReference *params.LocalReference
ResetCause *params.ResetCause
OptionalParameters []params.Parameter
// contains filtered or unexported fields
}
RSR represents an SCCP Reset Request message; see ITU-T Q.713 (03/01), section 4.14.
func (*RSR) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a RSR instance.
func (*RSR) MessageType ¶
MessageType returns the Message Type in int.
func (*RSR) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*RSR) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP RSR.
type SCMG ¶
type SCMG struct {
Type SCMGType
AffectedSSN uint8
AffectedPC uint16
SubsystemMultiplicityIndicator uint8
SCCPCongestionLevel uint8
}
SCMG represents a SCCP Management message (SCMG). See ITU-T Q.713 (03/01), section 5.3.
func (*SCMG) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a SCMG instance.
func (*SCMG) MessageType ¶
MessageType returns the Message Type in int.
func (*SCMG) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*SCMG) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCMG.
type SCMGType ¶
type SCMGType uint8
SCMGType is type of SCMG message.
const ( SCMGTypeSSA SCMGType // SSA SCMGTypeSSP // SSP SCMGTypeSST // SST SCMGTypeSOR // SOR SCMGTypeSOG // SOG SCMGTypeSSC // SSC )
ITU-T Q.713 (03/01), Table 23.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack owns local subsystem availability and connection-section state.
func NewStack ¶
func NewStack(config StackConfig) *Stack
NewStack creates an SCCP stack with local subsystem and connection-section state.
func (*Stack) Connection ¶
func (s *Stack) Connection(localReference uint32) (ConnectionSection, bool)
Connection returns a copy of the connection section for the local reference.
func (*Stack) HandleMessage ¶
func (s *Stack) HandleMessage(message Message) (StackResult, error)
HandleMessage applies SCCP stack procedures to an already decoded message.
func (*Stack) NewConnectionRequest ¶
func (s *Stack) NewConnectionRequest( protocolClass int, returnOnError bool, credit uint8, calledPartyAddress *params.PartyAddress, callingPartyAddress *params.PartyAddress, data []byte, ) (*CR, uint32, error)
NewConnectionRequest allocates a local reference, stores a pending section, and returns a CR.
func (*Stack) RegisterSubsystem ¶
RegisterSubsystem marks a local subsystem as available for connectionless delivery.
func (*Stack) ReleaseConnection ¶
func (s *Stack) ReleaseConnection(localReference uint32, cause params.ReleaseCauseValue, opts ...params.Parameter) (*RLSD, error)
ReleaseConnection starts release for an established connection section.
func (*Stack) SubsystemAvailable ¶
SubsystemAvailable reports whether a local subsystem is registered.
func (*Stack) UnregisterSubsystem ¶
UnregisterSubsystem marks a local subsystem as unavailable.
type StackConfig ¶
StackConfig configures an in-memory SCCP stack.
type StackResult ¶
type StackResult struct {
Deliveries []UnitdataIndication
DataIndications []DataIndication
Notices []NoticeIndication
Outbound []Message
}
StackResult contains local delivery, notice, and outbound messages produced by HandleMessage.
type UDT ¶
type UDT struct {
Type MsgType
ProtocolClass *params.ProtocolClass
CalledPartyAddress *params.PartyAddress
CallingPartyAddress *params.PartyAddress
Data *params.Data
// contains filtered or unexported fields
}
UDT represents a SCCP Message Unit Data (UDT).
func (*UDT) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a UDT instance.
func (*UDT) MarshalTo ¶
MarshalTo puts the byte sequence in the byte array given as b. SCCP is dependent on the Pointers when serializing, which means that it might fail when invalid Pointers are set.
func (*UDT) MessageType ¶
MessageType returns the Message Type in int.
func (*UDT) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*UDT) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP UDT.
type UDTS ¶
type UDTS struct {
Type MsgType
ReturnCause *params.ReturnCause
CalledPartyAddress *params.PartyAddress
CallingPartyAddress *params.PartyAddress
Data *params.Data
// contains filtered or unexported fields
}
UDTS represents an SCCP Unitdata Service message; see ITU-T Q.713 (03/01), section 4.11.
func NewUDTS ¶
func NewUDTS(rc params.ReturnCauseValue, cdpa, cgpa *params.PartyAddress, data []byte) *UDTS
NewUDTS creates a new UDTS.
func (*UDTS) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a UDTS instance.
func (*UDTS) MessageType ¶
MessageType returns the Message Type in int.
func (*UDTS) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*UDTS) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP UDTS.
type UnitdataIndication ¶
type UnitdataIndication struct {
Message Message
ProtocolClass int
ReturnOnError bool
CalledPartyAddress *params.PartyAddress
CallingPartyAddress *params.PartyAddress
Data []byte
}
UnitdataIndication represents an N-UNITDATA indication delivered to a local SCCP user.
type UnsupportedTypeError ¶
type UnsupportedTypeError uint8
UnsupportedTypeError indicates the value in Version field is invalid.
func (UnsupportedTypeError) Error ¶
func (e UnsupportedTypeError) Error() string
Error returns the type of receiver and some additional message.
type XUDT ¶
type XUDT struct {
Type MsgType
ProtocolClass *params.ProtocolClass
HopCounter *params.HopCounter
CalledPartyAddress *params.PartyAddress
CallingPartyAddress *params.PartyAddress
Data *params.Data
Segmentation *params.Segmentation
Importance *params.Importance
EndOfOptionalParameters *params.EndOfOptionalParameters
// contains filtered or unexported fields
}
XUDT represents a SCCP Message Extended unitdata (XUDT).
func NewXUDT ¶
func NewXUDT(pcls int, retOnErr bool, hc uint8, cdpa, cgpa *params.PartyAddress, data []byte, opts ...params.Parameter) *XUDT
NewXUDT creates a new XUDT.
func (*XUDT) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a XUDT instance.
func (*XUDT) MarshalTo ¶
MarshalTo puts the byte sequence in the byte array given as b. SCCP is dependent on the Pointers when serializing, which means that it might fail when invalid Pointers are set.
func (*XUDT) MessageType ¶
MessageType returns the Message Type in int.
func (*XUDT) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*XUDT) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP XUDT.
type XUDTS ¶
type XUDTS struct {
Type MsgType
ReturnCause *params.ReturnCause
HopCounter *params.HopCounter
CalledPartyAddress *params.PartyAddress
CallingPartyAddress *params.PartyAddress
Data *params.Data
Segmentation *params.Segmentation
Importance *params.Importance
EndOfOptionalParameters *params.EndOfOptionalParameters
// contains filtered or unexported fields
}
XUDTS represents an SCCP Extended Unitdata Service message; see ITU-T Q.713 (03/01), section 4.19.
func NewXUDTS ¶
func NewXUDTS(rc params.ReturnCauseValue, hc uint8, cdpa, cgpa *params.PartyAddress, data []byte, opts ...params.Parameter) *XUDTS
NewXUDTS creates a new XUDTS.
func ParseXUDTS ¶
ParseXUDTS decodes given byte sequence as a SCCP XUDTS.
func (*XUDTS) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a XUDTS instance.
func (*XUDTS) MessageType ¶
MessageType returns the Message Type in int.
func (*XUDTS) MessageTypeName ¶
MessageTypeName returns the Message Type in string.
func (*XUDTS) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a SCCP XUDTS.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
client
command
Command client sends given payload on top of SCCP UDT message.
|
Command client sends given payload on top of SCCP UDT message. |
|
server
command
Command receiver receives SCCP messages from the client and prints them out.
|
Command receiver receives SCCP messages from the client and prints them out. |
|
Package utils provides some utilities which might be useful specifically for GTP(or other telco protocols).
|
Package utils provides some utilities which might be useful specifically for GTP(or other telco protocols). |