sccp

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 10 Imported by: 0

README

go-sccp

CI status Security Go Reference License

go-sccp is a Go implementation of SCCP, the Signalling Connection Control Part used in SS7 and SIGTRAN stacks.

The package currently provides complete ITU-T Q.713 message and parameter encoding/decoding, plus the first Q.714 connection-section procedure helpers. It is suitable for building, parsing, validating, and testing SCCP wire messages while the full procedure stack is being completed.

Status

This module is pre-v1. Public APIs may still change while the Q.714 procedure layer is completed.

Implemented:

  • ITU-T Q.713 (03/01) message codecs for all SCCP message types.
  • ITU-T Q.713 (03/01) parameter codecs for the full standard parameter set.
  • Strict parser coverage for short buffers and malformed optional parameter lengths.
  • Fuzz targets for top-level message parsing and parameter parsing.
  • Initial ITU-T Q.714 (05/01) connection-section helpers for CC/CREF setup outcomes, RLSD/RLC release handling, reference mismatch detection, frozen reference state, class 2 DT1 data transfer, and class 3 DT2/AK sequence and flow-control windows.
  • In-memory SCCP stack core for local subsystem registration, connectionless N-UNITDATA delivery, UDTS/XUDTS/LUDTS return generation, N-NOTICE delivery, and connection-oriented section lifecycle orchestration.
  • CI for build, tests, race tests, vet, static analysis, vulnerability checks, portability, and security scanning.

Remaining stack work:

  • Q.714 global title translation, relay routing, compatibility tests, message type changes, segmentation, reassembly, and management procedure integration.
  • Q.714 freeze/guard timers and relay coupling for multi-section connections.
  • Q.714 class 3 reset, expedited data, inactivity testing, and timer behavior.
  • Q.714 connection-oriented segmentation/reassembly across multiple DT messages.

See docs/standards.md for the standards baseline, errata policy, open-source survey, and detailed compliance ledger.

Install

go get github.com/gomaja/go-sccp

Message Encoding

package main

import (
	"log"

	"github.com/gomaja/go-sccp"
	"github.com/gomaja/go-sccp/params"
)

func main() {
	msg := sccp.NewUDT(
		0,
		true,
		params.NewCalledPartyAddress(0x42, 0, 6, nil),
		params.NewCallingPartyAddress(0x42, 0, 7, nil),
		[]byte("payload"),
	)

	wire, err := msg.MarshalBinary()
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%x", wire)
}

Message Parsing

package main

import (
	"log"

	"github.com/gomaja/go-sccp"
)

func main() {
	msg, err := sccp.ParseMessage([]byte{
		0x09, 0x80, 0x03, 0x06, 0x09,
		0x02, 0x42, 0x06,
		0x02, 0x42, 0x07,
		0x07, 'p', 'a', 'y', 'l', 'o', 'a', 'd',
	})
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%s", msg.MessageTypeName())
}

Connection-Section Procedures

package main

import (
	"log"

	"github.com/gomaja/go-sccp"
	"github.com/gomaja/go-sccp/params"
)

func main() {
	section := sccp.NewPendingConnectionSection(0x010203, 3, 8)

	confirm := sccp.NewCC(0x010203, 0x040506, 2, false)
	if err := section.HandleConnectionConfirm(confirm); err != nil {
		log.Fatal(err)
	}

	released, err := section.Release(params.ReleaseCauseSCCPUserOriginated)
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%s to %06x", released.MessageTypeName(), released.DestinationLocalReference.Uint32())
}

Supported Messages

Message type Abbreviation Reference Codec
Connection request CR ITU-T Q.713 (03/01) 4.2 Yes
Connection confirm CC ITU-T Q.713 (03/01) 4.3 Yes
Connection refused CREF ITU-T Q.713 (03/01) 4.4 Yes
Released RLSD ITU-T Q.713 (03/01) 4.5 Yes
Release complete RLC ITU-T Q.713 (03/01) 4.6 Yes
Data form 1 DT1 ITU-T Q.713 (03/01) 4.7 Yes
Data form 2 DT2 ITU-T Q.713 (03/01) 4.8 Yes
Data acknowledgement AK ITU-T Q.713 (03/01) 4.9 Yes
Unitdata UDT ITU-T Q.713 (03/01) 4.10 Yes
Unitdata service UDTS ITU-T Q.713 (03/01) 4.11 Yes
Expedited data ED ITU-T Q.713 (03/01) 4.12 Yes
Expedited data acknowledgement EA ITU-T Q.713 (03/01) 4.13 Yes
Reset request RSR ITU-T Q.713 (03/01) 4.14 Yes
Reset confirm RSC ITU-T Q.713 (03/01) 4.15 Yes
Protocol data unit error ERR ITU-T Q.713 (03/01) 4.16 Yes
Inactivity test IT ITU-T Q.713 (03/01) 4.17 Yes
Extended unitdata XUDT ITU-T Q.713 (03/01) 4.18 Yes
Extended unitdata service XUDTS ITU-T Q.713 (03/01) 4.19 Yes
Long unitdata LUDT ITU-T Q.713 (03/01) 4.20 Yes
Long unitdata service LUDTS ITU-T Q.713 (03/01) 4.21 Yes

Supported Parameters

Parameter name Reference Codec
End of optional parameters ITU-T Q.713 (03/01) 3.1 Yes
Destination local reference ITU-T Q.713 (03/01) 3.2 Yes
Source local reference ITU-T Q.713 (03/01) 3.3 Yes
Called party address ITU-T Q.713 (03/01) 3.4 Yes
Calling party address ITU-T Q.713 (03/01) 3.5 Yes
Protocol class ITU-T Q.713 (03/01) 3.6 Yes
Segmenting/reassembling ITU-T Q.713 (03/01) 3.7 Yes
Receive sequence number ITU-T Q.713 (03/01) 3.8 Yes
Sequencing/segmenting ITU-T Q.713 (03/01) 3.9 Yes
Credit ITU-T Q.713 (03/01) 3.10 Yes
Release cause ITU-T Q.713 (03/01) 3.11 Yes
Return cause ITU-T Q.713 (03/01) 3.12 Yes
Reset cause ITU-T Q.713 (03/01) 3.13 Yes
Error cause ITU-T Q.713 (03/01) 3.14 Yes
Refusal cause ITU-T Q.713 (03/01) 3.15 Yes
Data ITU-T Q.713 (03/01) 3.16 Yes
Segmentation ITU-T Q.713 (03/01) 3.17 Yes
Hop counter ITU-T Q.713 (03/01) 3.18 Yes
Importance ITU-T Q.713 (03/01) 3.19 Yes
Long data ITU-T Q.713 (03/01) 3.20 Yes

Validation

The local validation target for Go changes is:

go build ./...
go test ./... -count=1
go vet ./...
~/go/bin/staticcheck ./...
~/go/bin/golangci-lint run ./...

Protocol changes should also run race tests and the relevant fuzz targets.

License

MIT. See LICENSE.

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

View Source
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")
)
View Source
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

func DecodeSequenceNumber(encoded uint8) uint8

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

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 EncodeSequenceNumber

func EncodeSequenceNumber(n uint8) uint8

EncodeSequenceNumber returns the Q.713 sequence-number octet for a decoded modulo-128 value.

func SetLogger

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

func NewAK(dst uint32, rcv, credit uint8) *AK

NewAK creates a new AK.

func ParseAK

func ParseAK(b []byte) (*AK, error)

ParseAK decodes given byte sequence as a SCCP AK.

func (*AK) MarshalBinary

func (a *AK) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from an AK instance.

func (*AK) MarshalLen

func (a *AK) MarshalLen() int

MarshalLen returns the serial length.

func (*AK) MarshalTo

func (a *AK) MarshalTo(b []byte) error

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

func (*AK) MessageType

func (a *AK) MessageType() MsgType

MessageType returns the Message Type in int.

func (*AK) MessageTypeName

func (a *AK) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*AK) String

func (a *AK) String() string

String returns the AK values in human readable format.

func (*AK) UnmarshalBinary

func (a *AK) UnmarshalBinary(b []byte) error

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 NewCC

func NewCC(dst, src uint32, pcls int, retOnErr bool, opts ...params.Parameter) *CC

NewCC creates a new CC.

func ParseCC

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

ParseCC decodes given byte sequence as a SCCP CC.

func (*CC) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a CC instance.

func (*CC) MarshalLen

func (c *CC) MarshalLen() int

MarshalLen returns the serial length.

func (*CC) MarshalTo

func (c *CC) MarshalTo(b []byte) error

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

func (*CC) MessageType

func (c *CC) MessageType() MsgType

MessageType returns the Message Type in int.

func (*CC) MessageTypeName

func (c *CC) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*CC) String

func (c *CC) String() string

String returns the CC values in human readable format.

func (*CC) UnmarshalBinary

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

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 ParseCR

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

ParseCR decodes given byte sequence as a SCCP CR.

func (*CR) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a CR instance.

func (*CR) MarshalLen

func (c *CR) MarshalLen() int

MarshalLen returns the serial length.

func (*CR) MarshalTo

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

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

func (*CR) MessageType

func (c *CR) MessageType() MsgType

MessageType returns the Message Type in int.

func (*CR) MessageTypeName

func (c *CR) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*CR) String

func (c *CR) String() string

String returns the CR values in human readable format.

func (*CR) UnmarshalBinary

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

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 NewCREF

func NewCREF(dst uint32, cause params.RefusalCauseValue, opts ...params.Parameter) *CREF

NewCREF creates a new CREF.

func ParseCREF

func ParseCREF(b []byte) (*CREF, error)

ParseCREF decodes given byte sequence as a SCCP CREF.

func (*CREF) MarshalBinary

func (c *CREF) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a CREF instance.

func (*CREF) MarshalLen

func (c *CREF) MarshalLen() int

MarshalLen returns the serial length.

func (*CREF) MarshalTo

func (c *CREF) MarshalTo(b []byte) error

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

func (*CREF) MessageType

func (c *CREF) MessageType() MsgType

MessageType returns the Message Type in int.

func (*CREF) MessageTypeName

func (c *CREF) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*CREF) String

func (c *CREF) String() string

String returns the CREF values in human readable format.

func (*CREF) UnmarshalBinary

func (c *CREF) UnmarshalBinary(b []byte) error

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 NewDT1

func NewDT1(dst uint32, moreData bool, data []byte) *DT1

NewDT1 creates a new DT1.

func ParseDT1

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

ParseDT1 decodes given byte sequence as a SCCP DT1.

func (*DT1) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a DT1 instance.

func (*DT1) MarshalLen

func (d *DT1) MarshalLen() int

MarshalLen returns the serial length.

func (*DT1) MarshalTo

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

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

func (*DT1) MessageType

func (d *DT1) MessageType() MsgType

MessageType returns the Message Type in int.

func (*DT1) MessageTypeName

func (d *DT1) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*DT1) String

func (d *DT1) String() string

String returns the DT1 values in human readable format.

func (*DT1) UnmarshalBinary

func (d *DT1) UnmarshalBinary(b []byte) error

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 NewDT2

func NewDT2(dst uint32, snd, rcv uint8, moreData bool, data []byte) *DT2

NewDT2 creates a new DT2.

func ParseDT2

func ParseDT2(b []byte) (*DT2, error)

ParseDT2 decodes given byte sequence as a SCCP DT2.

func (*DT2) MarshalBinary

func (d *DT2) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a DT2 instance.

func (*DT2) MarshalLen

func (d *DT2) MarshalLen() int

MarshalLen returns the serial length.

func (*DT2) MarshalTo

func (d *DT2) MarshalTo(b []byte) error

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

func (*DT2) MessageType

func (d *DT2) MessageType() MsgType

MessageType returns the Message Type in int.

func (*DT2) MessageTypeName

func (d *DT2) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*DT2) String

func (d *DT2) String() string

String returns the DT2 values in human readable format.

func (*DT2) UnmarshalBinary

func (d *DT2) UnmarshalBinary(b []byte) error

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 NewEA

func NewEA(dst uint32) *EA

NewEA creates a new EA.

func ParseEA

func ParseEA(b []byte) (*EA, error)

ParseEA decodes given byte sequence as a SCCP EA.

func (*EA) MarshalBinary

func (e *EA) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from an EA instance.

func (*EA) MarshalLen

func (e *EA) MarshalLen() int

MarshalLen returns the serial length.

func (*EA) MarshalTo

func (e *EA) MarshalTo(b []byte) error

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

func (*EA) MessageType

func (e *EA) MessageType() MsgType

MessageType returns the Message Type in int.

func (*EA) MessageTypeName

func (e *EA) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*EA) String

func (e *EA) String() string

String returns the EA values in human readable format.

func (*EA) UnmarshalBinary

func (e *EA) UnmarshalBinary(b []byte) error

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 NewED

func NewED(dst uint32, data []byte) *ED

NewED creates a new ED.

func ParseED

func ParseED(b []byte) (*ED, error)

ParseED decodes given byte sequence as a SCCP ED.

func (*ED) MarshalBinary

func (e *ED) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from an ED instance.

func (*ED) MarshalLen

func (e *ED) MarshalLen() int

MarshalLen returns the serial length.

func (*ED) MarshalTo

func (e *ED) MarshalTo(b []byte) error

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

func (*ED) MessageType

func (e *ED) MessageType() MsgType

MessageType returns the Message Type in int.

func (*ED) MessageTypeName

func (e *ED) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*ED) String

func (e *ED) String() string

String returns the ED values in human readable format.

func (*ED) UnmarshalBinary

func (e *ED) UnmarshalBinary(b []byte) error

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 NewERR

func NewERR(dst uint32, cause params.ErrorCauseValue, opts ...params.Parameter) *ERR

NewERR creates a new ERR.

func ParseERR

func ParseERR(b []byte) (*ERR, error)

ParseERR decodes given byte sequence as a SCCP ERR.

func (*ERR) MarshalBinary

func (e *ERR) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from an ERR instance.

func (*ERR) MarshalLen

func (e *ERR) MarshalLen() int

MarshalLen returns the serial length.

func (*ERR) MarshalTo

func (e *ERR) MarshalTo(b []byte) error

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

func (*ERR) MessageType

func (e *ERR) MessageType() MsgType

MessageType returns the Message Type in int.

func (*ERR) MessageTypeName

func (e *ERR) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*ERR) String

func (e *ERR) String() string

String returns the ERR values in human readable format.

func (*ERR) UnmarshalBinary

func (e *ERR) UnmarshalBinary(b []byte) error

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 ParseIT

func ParseIT(b []byte) (*IT, error)

ParseIT decodes given byte sequence as a SCCP IT.

func (*IT) MarshalBinary

func (i *IT) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from an IT instance.

func (*IT) MarshalLen

func (i *IT) MarshalLen() int

MarshalLen returns the serial length.

func (*IT) MarshalTo

func (i *IT) MarshalTo(b []byte) error

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

func (*IT) MessageType

func (i *IT) MessageType() MsgType

MessageType returns the Message Type in int.

func (*IT) MessageTypeName

func (i *IT) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*IT) String

func (i *IT) String() string

String returns the IT values in human readable format.

func (*IT) UnmarshalBinary

func (i *IT) UnmarshalBinary(b []byte) error

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 ParseLUDT

func ParseLUDT(b []byte) (*LUDT, error)

ParseLUDT decodes given byte sequence as a SCCP LUDT.

func (*LUDT) CdGT

func (l *LUDT) CdGT() string

CdGT returns the GT in CalledPartyAddress in human readable string.

func (*LUDT) CgGT

func (l *LUDT) CgGT() string

CgGT returns the GT in CallingPartyAddress in human readable string.

func (*LUDT) MarshalBinary

func (l *LUDT) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a LUDT instance.

func (*LUDT) MarshalLen

func (l *LUDT) MarshalLen() int

MarshalLen returns the serial length.

func (*LUDT) MarshalTo

func (l *LUDT) MarshalTo(b []byte) error

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

func (*LUDT) MessageType

func (l *LUDT) MessageType() MsgType

MessageType returns the Message Type in int.

func (*LUDT) MessageTypeName

func (l *LUDT) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*LUDT) String

func (l *LUDT) String() string

String returns the LUDT values in human readable format.

func (*LUDT) UnmarshalBinary

func (l *LUDT) UnmarshalBinary(b []byte) error

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

func ParseLUDTS(b []byte) (*LUDTS, error)

ParseLUDTS decodes given byte sequence as a SCCP LUDTS.

func (*LUDTS) CdGT

func (l *LUDTS) CdGT() string

CdGT returns the GT in CalledPartyAddress in human readable string.

func (*LUDTS) CgGT

func (l *LUDTS) CgGT() string

CgGT returns the GT in CallingPartyAddress in human readable string.

func (*LUDTS) MarshalBinary

func (l *LUDTS) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a LUDTS instance.

func (*LUDTS) MarshalLen

func (l *LUDTS) MarshalLen() int

MarshalLen returns the serial length.

func (*LUDTS) MarshalTo

func (l *LUDTS) MarshalTo(b []byte) error

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

func (*LUDTS) MessageType

func (l *LUDTS) MessageType() MsgType

MessageType returns the Message Type in int.

func (*LUDTS) MessageTypeName

func (l *LUDTS) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*LUDTS) String

func (l *LUDTS) String() string

String returns the LUDTS values in human readable format.

func (*LUDTS) UnmarshalBinary

func (l *LUDTS) UnmarshalBinary(b []byte) error

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

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

func (i MsgType) String() string

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 NewRLC

func NewRLC(dst, src uint32) *RLC

NewRLC creates a new RLC.

func ParseRLC

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

ParseRLC decodes given byte sequence as a SCCP RLC.

func (*RLC) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a RLC instance.

func (*RLC) MarshalLen

func (r *RLC) MarshalLen() int

MarshalLen returns the serial length.

func (*RLC) MarshalTo

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

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

func (*RLC) MessageType

func (r *RLC) MessageType() MsgType

MessageType returns the Message Type in int.

func (*RLC) MessageTypeName

func (r *RLC) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*RLC) String

func (r *RLC) String() string

String returns the RLC values in human readable format.

func (*RLC) UnmarshalBinary

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

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 NewRLSD

func NewRLSD(dst, src uint32, cause params.ReleaseCauseValue, opts ...params.Parameter) *RLSD

NewRLSD creates a new RLSD.

func ParseRLSD

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

ParseRLSD decodes given byte sequence as a SCCP RLSD.

func (*RLSD) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a RLSD instance.

func (*RLSD) MarshalLen

func (r *RLSD) MarshalLen() int

MarshalLen returns the serial length.

func (*RLSD) MarshalTo

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

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

func (*RLSD) MessageType

func (r *RLSD) MessageType() MsgType

MessageType returns the Message Type in int.

func (*RLSD) MessageTypeName

func (r *RLSD) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*RLSD) String

func (r *RLSD) String() string

String returns the RLSD values in human readable format.

func (*RLSD) UnmarshalBinary

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

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 NewRSC

func NewRSC(dst, src uint32) *RSC

NewRSC creates a new RSC.

func ParseRSC

func ParseRSC(b []byte) (*RSC, error)

ParseRSC decodes given byte sequence as a SCCP RSC.

func (*RSC) MarshalBinary

func (r *RSC) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a RSC instance.

func (*RSC) MarshalLen

func (r *RSC) MarshalLen() int

MarshalLen returns the serial length.

func (*RSC) MarshalTo

func (r *RSC) MarshalTo(b []byte) error

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

func (*RSC) MessageType

func (r *RSC) MessageType() MsgType

MessageType returns the Message Type in int.

func (*RSC) MessageTypeName

func (r *RSC) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*RSC) String

func (r *RSC) String() string

String returns the RSC values in human readable format.

func (*RSC) UnmarshalBinary

func (r *RSC) UnmarshalBinary(b []byte) error

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 NewRSR

func NewRSR(dst, src uint32, cause params.ResetCauseValue, opts ...params.Parameter) *RSR

NewRSR creates a new RSR.

func ParseRSR

func ParseRSR(b []byte) (*RSR, error)

ParseRSR decodes given byte sequence as a SCCP RSR.

func (*RSR) MarshalBinary

func (r *RSR) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a RSR instance.

func (*RSR) MarshalLen

func (r *RSR) MarshalLen() int

MarshalLen returns the serial length.

func (*RSR) MarshalTo

func (r *RSR) MarshalTo(b []byte) error

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

func (*RSR) MessageType

func (r *RSR) MessageType() MsgType

MessageType returns the Message Type in int.

func (*RSR) MessageTypeName

func (r *RSR) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*RSR) String

func (r *RSR) String() string

String returns the RSR values in human readable format.

func (*RSR) UnmarshalBinary

func (r *RSR) UnmarshalBinary(b []byte) error

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 NewSCMG

func NewSCMG(typ SCMGType, assn uint8, apc uint16, smi uint8, scl 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 // SSA
	SCMGTypeSSP          // SSP
	SCMGTypeSST          // SST
	SCMGTypeSOR          // SOR
	SCMGTypeSOG          // SOG
	SCMGTypeSSC          // SSC
)

ITU-T Q.713 (03/01), Table 23.

func (SCMGType) String

func (i SCMGType) String() string

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

func (s *Stack) RegisterSubsystem(ssn uint8)

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

func (s *Stack) SubsystemAvailable(ssn uint8) bool

SubsystemAvailable reports whether a local subsystem is registered.

func (*Stack) UnregisterSubsystem

func (s *Stack) UnregisterSubsystem(ssn uint8)

UnregisterSubsystem marks a local subsystem as unavailable.

type StackConfig

type StackConfig struct {
	LocalPointCode        uint16
	InitialLocalReference uint32
}

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

func ParseUDTS(b []byte) (*UDTS, error)

ParseUDTS decodes given byte sequence as a SCCP UDTS.

func (*UDTS) CdGT

func (u *UDTS) CdGT() string

CdGT returns the GT in CalledPartyAddress in human readable string.

func (*UDTS) CgGT

func (u *UDTS) CgGT() string

CgGT returns the GT in CallingPartyAddress in human readable string.

func (*UDTS) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a UDTS instance.

func (*UDTS) MarshalLen

func (u *UDTS) MarshalLen() int

MarshalLen returns the serial length.

func (*UDTS) MarshalTo

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

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

func (*UDTS) MessageType

func (u *UDTS) MessageType() MsgType

MessageType returns the Message Type in int.

func (*UDTS) MessageTypeName

func (u *UDTS) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*UDTS) String

func (u *UDTS) String() string

String returns the UDTS values in human readable format.

func (*UDTS) UnmarshalBinary

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

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 ParseXUDT

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

ParseXUDT decodes given byte sequence as a SCCP XUDT.

func (*XUDT) CdGT

func (x *XUDT) CdGT() string

CdGT returns the GT in CalledPartyAddress in human readable string.

func (*XUDT) CgGT

func (x *XUDT) CgGT() string

CgGT returns the GT in CalledPartyAddress in human readable string.

func (*XUDT) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a XUDT instance.

func (*XUDT) MarshalLen

func (x *XUDT) MarshalLen() int

MarshalLen returns the serial length.

func (*XUDT) MarshalTo

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

func (x *XUDT) MessageType() MsgType

MessageType returns the Message Type in int.

func (*XUDT) MessageTypeName

func (x *XUDT) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*XUDT) String

func (x *XUDT) String() string

String returns the XUDT values in human readable format.

func (*XUDT) UnmarshalBinary

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

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

func ParseXUDTS(b []byte) (*XUDTS, error)

ParseXUDTS decodes given byte sequence as a SCCP XUDTS.

func (*XUDTS) CdGT

func (x *XUDTS) CdGT() string

CdGT returns the GT in CalledPartyAddress in human readable string.

func (*XUDTS) CgGT

func (x *XUDTS) CgGT() string

CgGT returns the GT in CallingPartyAddress in human readable string.

func (*XUDTS) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a XUDTS instance.

func (*XUDTS) MarshalLen

func (x *XUDTS) MarshalLen() int

MarshalLen returns the serial length.

func (*XUDTS) MarshalTo

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

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

func (*XUDTS) MessageType

func (x *XUDTS) MessageType() MsgType

MessageType returns the Message Type in int.

func (*XUDTS) MessageTypeName

func (x *XUDTS) MessageTypeName() string

MessageTypeName returns the Message Type in string.

func (*XUDTS) String

func (x *XUDTS) String() string

String returns the XUDTS values in human readable format.

func (*XUDTS) UnmarshalBinary

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

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

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

Jump to

Keyboard shortcuts

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