sccp

package module
v0.0.0-...-925ed76 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 7 Imported by: 0

README

go-sccp Fork with Connection-Oriented Messages

As needed for the project in hand, GSM A-Interface etc

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

This section is empty.

Types

type CC

type CC struct {
	Type                      MsgType
	DestinationLocalReference uint32
	SourceLocalReference      uint32
	params.ProtocolClass

	Opts []*params.Optional

	Data               *params.Optional
	CalledPartyAddress *params.PartyAddress
}

func NewCC

func NewCC(dlr uint32, slr uint32, opts []*params.Optional) *CC

func ParseCC

func ParseCC(b []byte) (*CC, error)

ParseCC decodes given byte sequence as a SCCP CC.

func (*CC) MarshalBinary

func (msg *CC) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a CC instance.

func (*CC) MarshalLen

func (msg *CC) MarshalLen() int

func (*CC) MarshalTo

func (msg *CC) 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 (*CC) MessageType

func (msg *CC) MessageType() MsgType

MessageType returns the Message Type in int.

func (*CC) MessageTypeName

func (msg *CC) MessageTypeName() string

func (*CC) String

func (msg *CC) String() string

func (*CC) UnmarshalBinary

func (msg *CC) UnmarshalBinary(b []byte) error

type CR

type CR struct {
	Type                 MsgType
	SourceLocalReference uint32
	params.ProtocolClass
	CalledPartyAddress *params.PartyAddress

	Opts []*params.Optional // all others

	// just pointers, not used for Marshal-ing,  I kust really need these two
	// similar objects are expected to be found in Opts
	Data                *params.Optional
	CallingPartyAddress *params.PartyAddress
}

func NewCR

func NewCR(slr uint32, cdpty *params.PartyAddress, opts []*params.Optional) *CR

func ParseCR

func ParseCR(b []byte) (*CR, error)

func (*CR) MarshalBinary

func (msg *CR) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a CR instance.

func (*CR) MarshalLen

func (msg *CR) MarshalLen() int

func (*CR) MarshalTo

func (msg *CR) MarshalTo(b []byte) error

func (*CR) MessageType

func (msg *CR) MessageType() MsgType

MessageType returns the Message Type in int.

func (*CR) MessageTypeName

func (msg *CR) MessageTypeName() string

func (*CR) String

func (msg *CR) String() string

func (*CR) UnmarshalBinary

func (msg *CR) UnmarshalBinary(b []byte) error

type DT1

type DT1 struct {
	Type                      MsgType
	DestinationLocalReference uint32
	Segmenting                uint8
	Data                      []byte
}

func NewDT1

func NewDT1(dlr uint32, data []byte) *DT1

func ParseDT1

func ParseDT1(b []byte) (*DT1, error)

func (*DT1) MarshalBinary

func (msg *DT1) MarshalBinary() ([]byte, error)

func (*DT1) MarshalLen

func (msg *DT1) MarshalLen() int

func (*DT1) MarshalTo

func (msg *DT1) MarshalTo(b []byte) error

func (*DT1) MessageType

func (msg *DT1) MessageType() MsgType

MessageType returns the Message Type in int.

func (*DT1) MessageTypeName

func (msg *DT1) MessageTypeName() string

func (*DT1) String

func (msg *DT1) String() string

func (*DT1) UnmarshalBinary

func (msg *DT1) UnmarshalBinary(b []byte) error
type Header struct {
	Type    MsgType
	Payload []byte
}

Header is a SCCP common header.

func NewHeader

func NewHeader(mtype MsgType, payload []byte) *Header

NewHeader creates a new Header.

func ParseHeader

func ParseHeader(b []byte) (*Header, error)

ParseHeader decodes given byte sequence as a SCCP common header.

func (*Header) MarshalBinary

func (h *Header) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a Header instance.

func (*Header) MarshalLen

func (h *Header) MarshalLen() int

MarshalLen returns the serial length.

func (*Header) MarshalTo

func (h *Header) MarshalTo(b []byte) error

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

func (*Header) String

func (h *Header) String() string

String returns the SCCP common header values in human readable format.

func (*Header) UnmarshalBinary

func (h *Header) UnmarshalBinary(b []byte) error

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

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. Currently this only supports UDT type of message only.

type MsgType

type MsgType uint8

MsgType is type of SCCP message.

const (
	MsgTypeCR MsgType
	MsgTypeCC
	MsgTypeCREF
	MsgTypeRLSD
	MsgTypeRLC
	MsgTypeDT1
	MsgTypeDT2
	MsgTypeAK
	MsgTypeUDT
	MsgTypeUDTS
	MsgTypeED
	MsgTypeEA
	MsgTypeRSR
	MsgTypeRSC
	MsgTypeERR
	MsgTypeIT
	MsgTypeXUDT
	MsgTypeXUDTS
	MsgTypeLUDT
	MsgTypeLUDTS
)

Message Type definitions.

type RLC

type RLC struct {
	Type                      MsgType
	DestinationLocalReference uint32
	SourceLocalReference      uint32
}

func NewRLC

func NewRLC(dlr, slr uint32) *RLC

func ParseRLC

func ParseRLC(b []byte) (*RLC, error)

func (*RLC) MarshalBinary

func (msg *RLC) MarshalBinary() ([]byte, error)

func (*RLC) MarshalLen

func (msg *RLC) MarshalLen() int

func (*RLC) MarshalTo

func (msg *RLC) MarshalTo(b []byte) error

func (*RLC) MessageType

func (msg *RLC) MessageType() MsgType

MessageType returns the Message Type in int.

func (*RLC) MessageTypeName

func (msg *RLC) MessageTypeName() string

func (*RLC) String

func (msg *RLC) String() string

func (*RLC) UnmarshalBinary

func (msg *RLC) UnmarshalBinary(b []byte) error

type RLSD

type RLSD struct {
	Type                      MsgType
	DestinationLocalReference uint32
	SourceLocalReference      uint32
	Cause                     byte

	Opts []*params.Optional
}

func NewRLSD

func NewRLSD(dlr uint32, slr uint32, cause byte, opts []*params.Optional) *RLSD

func ParseRLSD

func ParseRLSD(b []byte) (*RLSD, error)

func (*RLSD) MarshalBinary

func (msg *RLSD) MarshalBinary() ([]byte, error)

func (*RLSD) MarshalLen

func (msg *RLSD) MarshalLen() int

func (*RLSD) MarshalTo

func (msg *RLSD) MarshalTo(b []byte) error

func (*RLSD) MessageType

func (msg *RLSD) MessageType() MsgType

MessageType returns the Message Type in int.

func (*RLSD) MessageTypeName

func (msg *RLSD) MessageTypeName() string

func (*RLSD) String

func (msg *RLSD) String() string

func (*RLSD) UnmarshalBinary

func (msg *RLSD) UnmarshalBinary(b []byte) error

type SCMG

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

func NewSCMG(typ SCMGType, affectedSSN uint8, affectedPC uint16, subsystemMultiplicityIndicator uint8, sccpCongestionLevel uint8) *SCMG

NewSCMG creates a new SCMG.

func ParseSCMG

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

ParseSCMG decodes given byte sequence as a SCMG.

func (*SCMG) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a SCMG instance.

func (*SCMG) MarshalLen

func (s *SCMG) MarshalLen() int

MarshalLen returns the serial length.

func (*SCMG) MarshalTo

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

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

func (*SCMG) MessageType

func (s *SCMG) MessageType() SCMGType

MessageType returns the Message Type in int.

func (*SCMG) MessageTypeName

func (s *SCMG) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*SCMG) String

func (s *SCMG) String() string

String returns the SCMG values in human readable format.

func (*SCMG) UnmarshalBinary

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

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
	SCMGTypeSSP
	SCMGTypeSST
	SCMGTypeSOR
	SCMGTypeSOG
	SCMGTypeSSC
)

Table 23/Q.713

type UDT

type UDT struct {
	Type MsgType
	params.ProtocolClass
	Ptr1, Ptr2, Ptr3    uint8
	CalledPartyAddress  *params.PartyAddress
	CallingPartyAddress *params.PartyAddress
	DataLength          uint8
	Data                []byte
}

UDT represents a SCCP Message Unit Data(UDT).

func NewUDT

func NewUDT(pcls int, mhandle 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) SetLength

func (u *UDT) SetLength()

SetLength sets the length in Length field.

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 byte

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.

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