sccp

package module
v0.0.0-...-9ad1fc4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 5 Imported by: 1

README

go-sccp: SCCP in Golang

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

CircleCI GoDoc License

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 -
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
Destination local reference 3.2
Source local reference 3.3
Called party address 3.4 Yes
Calling party address 3.5 Yes
Protocol class 3.6 Yes
Segmenting/reassembling 3.7
Receive sequence number 3.8
Sequencing/segmenting 3.9
Credit 3.10
Release cause 3.11
Return cause 3.12
Reset cause 3.13
Error cause 3.14
Refusal cause 3.15
Data 3.16 Yes
Segmentation 3.17
Hop counter 3.18
Importance 3.19
Long data 3.20

Author(s)

Yoshiyuki Kurauchi (Website / LinkedIn)

I'm always open to welcome co-authors! Please feel free to talk to me.

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

This section is empty.

Types

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