sccp

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 9 Imported by: 4

README

go-sccp

Package sccp provides simple and painless handling of SCCP (Signaling Connection Control Part) in SS7/SIGTRAN stack, implemented in the Go Programming Language.

CI status golangci-lint Go Reference GitHub

Disclaimer

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.

Getting started

Run go mod tidy to download the dependency, and you're ready to start developing.

Supported Features

Message Types
Message type Abbreviation Reference Supported?
Connection request CR 4.2 -
Connection confirm CC 4.3 -
Connection refused CREF 4.4 -
Released RLSD 4.5 -
Release complete RLC 4.6 -
Data form 1 DT1 4.7 -
Data form 2 DT2 4.8 -
Data acknowledgement AK 4.9 -
Unitdata UDT 4.10 Yes
Unitdata service UDTS 4.11 -
Expedited data ED 4.12 -
Expedited data acknowledgement EA 4.13 -
Reset request RSR 4.14 -
Reset confirm RSC 4.15 -
Protocol data unit error ERR 4.16 -
Inactivity test IT 4.17 -
Extended unitdata XUDT 4.18 Yes
Extended unitdata service XUDTS 4.19 -
Long unitdata LUDT 4.20 -
Long unitdata service LUDTS 4.21 -
Parameters
Parameter name Reference Supported?
End of optional parameters 3.1 Yes
Destination local reference 3.2 Yes
Source local reference 3.3 Yes
Called party address 3.4 Yes
Calling party address 3.5 Yes
Protocol class 3.6 Yes
Segmenting/reassembling 3.7 Yes
Receive sequence number 3.8 Yes
Sequencing/segmenting 3.9 Yes
Credit 3.10 Yes
Release cause 3.11 Yes
Return cause 3.12 Yes
Reset cause 3.13 Yes
Error cause 3.14 Yes
Refusal cause 3.15 Yes
Data 3.16 Yes
Segmentation 3.17 Yes
Hop counter 3.18 Yes
Importance 3.19 Yes
Long data 3.20 Yes

Author(s)

Yoshiyuki Kurauchi (Website) and contributors.

LICENSE

MIT

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLogging added in v0.0.4

func DisableLogging()

DisableLogging disables the logging from the package. Logging is enabled by default.

func EnableLogging added in v0.0.4

func EnableLogging(l *log.Logger)

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 SetLogger added in v0.0.4

func SetLogger(l *log.Logger)

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 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

func ParseMessage(b []byte) (Message, error)

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.

func (MsgType) String added in v0.0.4

func (i MsgType) String() string

type SCMG added in v0.0.3

type SCMG struct {
	Type                           SCMGType
	AffectedSSN                    uint8
	AffectedPC                     uint16
	SubsystemMultiplicityIndicator uint8
	SCCPCongestionLevel            uint8
}

SCMG represents a SCCP Management message (SCMG). Chapter 5.3/Q.713

func NewSCMG added in v0.0.3

func NewSCMG(typ SCMGType, assn uint8, apc uint16, smi uint8, scl uint8) *SCMG

NewSCMG creates a new SCMG.

func ParseSCMG added in v0.0.3

func ParseSCMG(b []byte) (*SCMG, error)

ParseSCMG decodes given byte sequence as a SCMG.

func (*SCMG) MarshalBinary added in v0.0.3

func (s *SCMG) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a SCMG instance.

func (*SCMG) MarshalLen added in v0.0.3

func (s *SCMG) MarshalLen() int

MarshalLen returns the serial length.

func (*SCMG) MarshalTo added in v0.0.3

func (s *SCMG) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*SCMG) MessageType added in v0.0.3

func (s *SCMG) MessageType() SCMGType

MessageType returns the Message Type in int.

func (*SCMG) MessageTypeName added in v0.0.3

func (s *SCMG) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*SCMG) String added in v0.0.3

func (s *SCMG) String() string

String returns the SCMG values in human readable format.

func (*SCMG) UnmarshalBinary added in v0.0.3

func (s *SCMG) UnmarshalBinary(b []byte) error

UnmarshalBinary sets the values retrieved from byte sequence in a SCMG.

type SCMGType added in v0.0.3

type SCMGType uint8

SCMGType is type of SCMG message.

const (
	SCMGTypeSSA SCMGType // SSA
	SCMGTypeSSP          // SSP
	SCMGTypeSST          // SST
	SCMGTypeSOR          // SOR
	SCMGTypeSOG          // SOG
	SCMGTypeSSC          // SSC
)

Table 23/Q.713

func (SCMGType) String added in v0.0.4

func (i SCMGType) String() string

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 NewUDT

func NewUDT(pcls int, retOnErr bool, cdpa, cgpa *params.PartyAddress, data []byte) *UDT

NewUDT creates a new UDT.

func ParseUDT

func ParseUDT(b []byte) (*UDT, error)

ParseUDT decodes given byte sequence as a SCCP UDT.

func (*UDT) CdGT

func (u *UDT) CdGT() string

CdGT returns the GT in CalledPartyAddress in human readable string.

func (*UDT) CgGT

func (u *UDT) CgGT() string

CgGT returns the GT in CalledPartyAddress in human readable string.

func (*UDT) MarshalBinary

func (u *UDT) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a UDT instance.

func (*UDT) MarshalLen

func (u *UDT) MarshalLen() int

MarshalLen returns the serial length.

func (*UDT) MarshalTo

func (u *UDT) MarshalTo(b []byte) error

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

func (u *UDT) MessageType() MsgType

MessageType returns the Message Type in int.

func (*UDT) MessageTypeName

func (u *UDT) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*UDT) String

func (u *UDT) String() string

String returns the UDT values in human readable format.

func (*UDT) UnmarshalBinary

func (u *UDT) UnmarshalBinary(b []byte) error

UnmarshalBinary sets the values retrieved from byte sequence in a SCCP UDT.

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 added in v0.0.4

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 added in v0.0.4

func NewXUDT(pcls int, retOnErr bool, hc uint8, cdpa, cgpa *params.PartyAddress, data []byte, opts ...params.Parameter) *XUDT

NewXUDT creates a new XUDT.

func ParseXUDT added in v0.0.4

func ParseXUDT(b []byte) (*XUDT, error)

ParseXUDT decodes given byte sequence as a SCCP XUDT.

func (*XUDT) CdGT added in v0.0.4

func (x *XUDT) CdGT() string

CdGT returns the GT in CalledPartyAddress in human readable string.

func (*XUDT) CgGT added in v0.0.4

func (x *XUDT) CgGT() string

CgGT returns the GT in CalledPartyAddress in human readable string.

func (*XUDT) MarshalBinary added in v0.0.4

func (x *XUDT) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a XUDT instance.

func (*XUDT) MarshalLen added in v0.0.4

func (x *XUDT) MarshalLen() int

MarshalLen returns the serial length.

func (*XUDT) MarshalTo added in v0.0.4

func (x *XUDT) MarshalTo(b []byte) error

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 added in v0.0.4

func (x *XUDT) MessageType() MsgType

MessageType returns the Message Type in int.

func (*XUDT) MessageTypeName added in v0.0.4

func (x *XUDT) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*XUDT) String added in v0.0.4

func (x *XUDT) String() string

String returns the XUDT values in human readable format.

func (*XUDT) UnmarshalBinary added in v0.0.4

func (x *XUDT) UnmarshalBinary(b []byte) error

UnmarshalBinary sets the values retrieved from byte sequence in a SCCP XUDT.

Directories

Path Synopsis
examples
client
Command client sends given payload on top of SCCP UDT message.
Command client sends given payload on top of SCCP UDT message.
server
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).

Jump to

Keyboard shortcuts

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