tcap

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 8 Imported by: 0

README

go-tcap

Simple TCAP implementation in Golang

CircleCI GoDoc GitHub

Package tcap provides simple and painless handling of TCAP(Transaction Capabilities Application Part) in SS7/SIGTRAN protocol stack, implemented in the Go Programming Language.

Though TCAP is ASN.1-based protocol, this implementation does not use any ASN.1 parser. That makes this implementation flexible enough to create arbitrary payload with any combinations, which is useful for testing.

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

Prerequisites

go-gtp supports Go Modules. Just run go mod tidy in your project's directory to collect the required packages automatically.

go mod tidy

This project follows the Release Policy of Go.

Running examples

A sample client is available in examples/client/, which, by default, establishes SCTP/M3UA connection with a server sends a MAP cancelLocation.

Transaction Capabilities Application Part
    begin
        [Transaction Id: 11111111]
        Source Transaction ID
        oid: 0.0.17.773.1.1.1 (id-as-dialogue)
        dialogueRequest
        components: 1 item
            Component: invoke (1)
                invoke
                    invokeID: 0
                    opCode: localValue (0)
                    CONSTRUCTOR
                        CONSTRUCTOR Tag
                        Tag: 0x00
                        Length: 10
                        Parameter (0x04)
                            Tag: 0x04
                            Length: 8
                        Data: 00
GSM Mobile Application
    Component: invoke (1)
        invoke
            invokeID: 0
            opCode: localValue (0)
                localValue: cancelLocation (3)
            identity: imsi-WithLMSI (1)
                imsi-WithLMSI
                    IMSI: 001010123456789
                    [Association IMSI: 001010123456789]

Some parameters can be speficied from command-line arguments. Other parameters including the ones in lower layers (such as Point Code in M3UA, Global Title in SCCP, etc.) should be updated by modifying the source code.

$ ./client -h
Usage of client:
  -addr string
        Remote IP and Port to connect to. (default "127.0.0.2:2905")
  -opcode int
        Operation Code in int. (default 3)
  -otid int
        Originating Transaction ID in uint32. (default 286331153)
  -payload string
        Hex representation of the payload (default "040800010121436587f9")

If you are looking for a server that just can accept a SCTP/M3UA connection to receive a TCAP packet, server example in go-m3ua project would be a nice choice for you.

Supported Features

Transaction Portion
Message Types
Message type Supported?
Unidirectional
Begin Yes
End Yes
Continue Yes
Abort Yes
Fields
Tag Supported?
Originating Transaction ID Yes
Destination Transaction ID Yes
P-Abort Cause Yes
Component Portion
Component types
Component type Supported?
Invoke Yes
Return Result (Last) Yes
Return Result (Not Last) Yes
Return Error Yes
Reject Yes
Dialogue Portion
Dialogue types
Dialogue type Supported?
Dialogue Request (AARQ-apdu) Yes
Dialogue Response (AARE-apdu) Yes
Dialogue Abort (ABRT-apdu) Yes
Unidirectional Dialogue (AUDT-apdu)
Elements
Tag Type Supported?
Object Identifier Structured Yes
Single-ASN.1-type Structured Yes
Dialogue PDU Structured Yes
Object Identifier Unstructured
Single-ASN.1-type Unstructured
Unidirectional Dialogue PDU Unstructured

Author(s)

Yoshiyuki Kurauchi (Website / Twitter)

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

LICENSE

MIT

Documentation

Overview

Package tcap provides simple and painless handling of TCAP(Transaction Capabilities Application Part) in SS7/SIGTRAN protocol stack.

Though TCAP is ASN.1-based protocol, this implementation does not use any ASN.1 parser. That makes this implementation flexible enough to create arbitrary payload with any combinations, which is useful for testing.

Index

Constants

View Source
const (
	Invoke int = iota + 1
	ReturnResultLast
	ReturnError
	Reject

	ReturnResultNotLast
)

Component Type definitions.

View Source
const (
	GeneralProblem int = iota
	InvokeProblem
	ReturnResultProblem
	ReturnErrorProblem
)

Problem Type definitions.

View Source
const (
	UnrecognizedComponent uint8 = iota
	MistypedComponent
	BadlyStructuredComponent
)

General Problem Code definitions.

View Source
const (
	InvokeProblemDuplicateInvokeID uint8 = iota
	InvokeProblemUnrecognizedOperation
	InvokeProblemMistypedParameter
	InvokeProblemResourceLimitation
	InvokeProblemInitiatingRelease
	InvokeProblemUnrecognizedLinkedID
	InvokeProblemLinkedResponseUnexpected
	InvokeProblemUnexpectedLinkedOperation
)

Invoke Problem Code definitions.

View Source
const (
	ResultProblemUnrecognizedInvokeID uint8 = iota
	ResultProblemReturnResultUnexpected
	ResultProblemMistypedParameter
)

ReturnResult Problem Code definitions.

View Source
const (
	ErrorProblemUnrecognizedInvokeID uint8 = iota
	ErrorProblemReturnErrorUnexpected
	ErrorProblemUnrecognizedError
	ErrorProblemUnexpectedError
	ErrorProblemMistypedParameter
)

ReturnError Problem Code definitions.

View Source
const (
	AARQ = iota
	AARE
	ABRT
)

Code definitions.

View Source
const (
	NetworkLocUpContext uint8
	LocationCancellationContext
	RoamingNumberEnquiryContext
	IstAlertingContext
	LocationInfoRetrievalContext
	CallControlTransferContext
	ReportingContext
	CallCompletionContext
	ServiceTerminationContext
	ResetContext
	HandoverControlContext
	SIWFSAllocationContext
	EquipmentMngtContext
	InfoRetrievalContext
	InterVlrInfoRetrievalContext
	SubscriberDataMngtContext
	TracingContext
	NetworkFunctionalSsContext
	NetworkUnstructuredSsContext
	ShortMsgGatewayContext
	ShortMsgRelayContext
	SubscriberDataModificationNotificationContext
	ShortMsgAlertContext
	MwdMngtContext
	ShortMsgMTRelayContext
	ImsiRetrievalContext
	MsPurgingContext
	SubscriberInfoEnquiryContext
	AnyTimeInfoEnquiryContext

	GroupCallControlContext
	GprsLocationUpdateContext
	GprsLocationInfoRetrievalContext
	FailureReportContext
	GprsNotifyContext
	SsInvocationNotificationContext
	LocationSvcGatewayContext
	LocationSvcEnquiryContext
	AuthenticationFailureReportContext

	MmEventReportingContext
	AnyTimeInfoHandlingContext
	SendRoutingInfoForSM
)

Application Context definitions.

View Source
const (
	Accepted uint8 = iota
	RejectPerm
)

Result Value defnitions.

View Source
const (
	DialogueServiceUser int
	DialogueServiceProvider
)

Dialogue Service Diagnostic Tag defnitions.

View Source
const (
	Null uint8 = iota
	NoReasonGiven
	ApplicationContextNameNotSupplied
	NoCommonDialoguePortion = 2 // same as above...
)

Reason defnitions for Dialogue Service User Diagnostic in ResultSourceDiagnostic.

View Source
const (
	AbortDialogueServiceUser int = iota
	AbortDialogueServiceProvider
)

Abort Source defnitions.

View Source
const (
	DialogueAsID uint8 = iota + 1
	UnidialogueAsID
)

Dialogue OID: Dialogue-As-ID and Unidialogue-As-Id.

View Source
const (
	Universal int = iota
	ApplicationWide
	ContextSpecific
	Private
)

Class definitions.

View Source
const (
	Primitive int = iota
	Constructor
)

Type definitions.

View Source
const (
	Unidirectional int = iota + 1
	Begin

	End
	Continue

	Abort
)

Message Type definitions.

View Source
const (
	UnrecognizedMessageType uint8 = iota
	UnrecognizedTransactionID
	BadlyFormattedTransactionPortion
	IncorrectTransactionPortion
	ResourceLimitation
)

Abort Cause definitions.

Variables

This section is empty.

Functions

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

type Component struct {
	Type          Tag
	Length        uint8
	InvokeID      *IE
	LinkedID      *IE
	ResultRetres  *IE
	SequenceTag   *IE
	OperationCode *IE
	ErrorCode     *IE
	ProblemCode   *IE
	Parameter     *IE
}

Component represents a TCAP Component.

func NewInvoke

func NewInvoke(invID, lkID, opCode int, isLocal bool, param []byte) *Component

NewInvoke returns a new single Invoke Component.

func NewReject

func NewReject(invID, problemType int, problemCode uint8, param []byte) *Component

NewReject returns a new single Reject Component.

func NewReturnError

func NewReturnError(invID, errCode int, isLocal bool, param []byte) *Component

NewReturnError returns a new single ReturnError Component.

func NewReturnResult

func NewReturnResult(invID, opCode int, isLocal, isLast bool, param []byte) *Component

NewReturnResult returns a new single ReturnResultLast or ReturnResultNotLast Component.

func ParseComponent

func ParseComponent(b []byte) (*Component, error)

ParseComponent parses given byte sequence as an Component.

func (*Component) ComponentTypeString

func (c *Component) ComponentTypeString() string

ComponentTypeString returns the Component Type in string.

func (*Component) InvID

func (c *Component) InvID() uint8

InvID returns the InvID in string.

func (*Component) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a Components instance.

func (*Component) MarshalLen

func (c *Component) MarshalLen() int

MarshalLen returns the serial length of Component.

func (*Component) MarshalTo

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

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

func (*Component) OpCode

func (c *Component) OpCode() uint8

OpCode returns the OpCode in string.

func (*Component) SetLength

func (c *Component) SetLength()

SetLength sets the length in Length field.

func (*Component) String

func (c *Component) String() string

String returns Component in human readable string.

func (*Component) UnmarshalBinary

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

UnmarshalBinary sets the values retrieved from byte sequence in an Component.

type Components

type Components struct {
	Tag       Tag
	Length    uint8
	Component []*Component
}

Components represents a TCAP Components(Header).

This is a TCAP Components' Header part. Contents are in Component field.

func NewComponents

func NewComponents(comps ...*Component) *Components

NewComponents creates a new Components.

func ParseComponents

func ParseComponents(b []byte) (*Components, error)

ParseComponents parses given byte sequence as an Components.

func (*Components) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a Components instance.

func (*Components) MarshalLen

func (c *Components) MarshalLen() int

MarshalLen returns the serial length of Components.

func (*Components) MarshalTo

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

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

func (*Components) SetLength

func (c *Components) SetLength()

SetLength sets the length in Length field.

func (*Components) SetValsFrom

func (c *Components) SetValsFrom(berParsed *IE) error

SetValsFrom sets the values from IE parsed by ParseBER.

func (*Components) String

func (c *Components) String() string

String returns Components in human readable string.

func (*Components) UnmarshalBinary

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

UnmarshalBinary sets the values retrieved from byte sequence in an Components.

type Dialogue

type Dialogue struct {
	Tag              Tag
	Length           uint8
	ExternalTag      Tag
	ExternalLength   uint8
	ObjectIdentifier *IE
	SingleAsn1Type   *IE
	DialoguePDU      *DialoguePDU
	Payload          []byte
}

Dialogue represents a Dialogue Portion of TCAP.

func NewDialogue

func NewDialogue(oid, ver uint8, pdu *DialoguePDU, payload []byte) *Dialogue

NewDialogue creates a new Dialogue with the DialoguePDU given.

func ParseDialogue

func ParseDialogue(b []byte) (*Dialogue, error)

ParseDialogue parses given byte sequence as an Dialogue.

func (*Dialogue) Context

func (d *Dialogue) Context() string

Context returns the Context part of ApplicationContextName in string.

func (*Dialogue) ContextVersion

func (d *Dialogue) ContextVersion() string

ContextVersion returns the Version part of ApplicationContextName in string.

func (*Dialogue) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a Dialogue instance.

func (*Dialogue) MarshalLen

func (d *Dialogue) MarshalLen() int

MarshalLen returns the serial length of Dialogue.

func (*Dialogue) MarshalTo

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

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

func (*Dialogue) SetLength

func (d *Dialogue) SetLength()

SetLength sets the length in Length field.

func (*Dialogue) SetValsFrom

func (d *Dialogue) SetValsFrom(berParsed *IE) error

SetValsFrom sets the values from IE parsed by ParseBER.

func (*Dialogue) String

func (d *Dialogue) String() string

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

func (*Dialogue) UnmarshalBinary

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

UnmarshalBinary sets the values retrieved from byte sequence in an Dialogue.

func (*Dialogue) Version

func (d *Dialogue) Version() string

Version returns Protocol Version in string.

type DialoguePDU

type DialoguePDU struct {
	Type                   Tag
	Length                 uint8
	ProtocolVersion        *IE
	ApplicationContextName *IE
	Result                 *IE
	ResultSourceDiagnostic *IE
	AbortSource            *IE
	UserInformation        *IE
}

DialoguePDU represents a DialoguePDU field in Dialogue.

func NewAARE

func NewAARE(protover int, context, contextver, result uint8, diagsrc int, reason uint8, userinfo ...*IE) *DialoguePDU

NewAARE returns a new AARE(Dialogue Response).

func NewAARQ

func NewAARQ(protover int, context, contextver uint8, userinfo ...*IE) *DialoguePDU

NewAARQ returns a new AARQ(Dialogue Request).

func NewABRT

func NewABRT(abortsrc uint8, userinfo ...*IE) *DialoguePDU

NewABRT returns a new ABRT(Dialogue Abort).

func NewDialoguePDU

func NewDialoguePDU(dtype, pver int, ctx, ctxver, result uint8, diagsrc int, diagreason, abortsrc uint8, userinfo ...*IE) *DialoguePDU

NewDialoguePDU creates a new DialoguePDU.

func ParseDialoguePDU

func ParseDialoguePDU(b []byte) (*DialoguePDU, error)

ParseDialoguePDU parses given byte sequence as an DialoguePDU.

func (*DialoguePDU) Context

func (d *DialoguePDU) Context() string

Context returns the Context part of ApplicationContextName in string.

func (*DialoguePDU) ContextVersion

func (d *DialoguePDU) ContextVersion() string

ContextVersion returns the Version part of ApplicationContextName in string.

func (*DialoguePDU) DialogueType

func (d *DialoguePDU) DialogueType() string

DialogueType returns the name of Dialogue Type in string.

func (*DialoguePDU) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a Dialogue instance.

func (*DialoguePDU) MarshalLen

func (d *DialoguePDU) MarshalLen() int

MarshalLen returns the serial length of DialoguePDU.

func (*DialoguePDU) MarshalTo

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

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

func (*DialoguePDU) SetLength

func (d *DialoguePDU) SetLength()

SetLength sets the length in Length field.

func (*DialoguePDU) String

func (d *DialoguePDU) String() string

String returns DialoguePDU in human readable string.

func (*DialoguePDU) UnmarshalBinary

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

UnmarshalBinary sets the values retrieved from byte sequence in an DialoguePDU.

func (*DialoguePDU) Version

func (d *DialoguePDU) Version() string

Version returns Protocol Version in string.

type IE

type IE struct {
	Tag
	Length uint8
	Value  []byte
	IE     []*IE
}

IE is a General Structure of TCAP Information Elements.

func NewAbortSource

func NewAbortSource(src uint8) *IE

NewAbortSource returns a new AbortSource as an IE.

func NewApplicationContextName

func NewApplicationContextName(ctx, ver uint8) *IE

NewApplicationContextName creates a new ApplicationContextName as an IE. Note: In this function, each length in fields are hard-coded.

func NewErrorCode

func NewErrorCode(code int, isLocal bool) *IE

NewErrorCode returns a Error Code.

func NewIE

func NewIE(tag Tag, value []byte) *IE

NewIE creates a new IE.

func NewOperationCode

func NewOperationCode(code int, isLocal bool) *IE

NewOperationCode returns a Operation Code.

func NewResult

func NewResult(res uint8) *IE

NewResult returns a new Result.

func NewResultSourceDiagnostic

func NewResultSourceDiagnostic(dtype int, reason uint8) *IE

NewResultSourceDiagnostic returns a new ResultSourceDiagnostic as an IE.

func ParseAsBER

func ParseAsBER(b []byte) ([]*IE, error)

ParseAsBER parses given byte sequence as multiple IEs.

func ParseAsBer deprecated

func ParseAsBer(b []byte) ([]*IE, error)

ParseAsBer parses given byte sequence as multiple IEs.

Deprecated: use ParseAsBER instead.

func ParseIE

func ParseIE(b []byte) (*IE, error)

ParseIE parses given byte sequence as an IE.

func ParseIERecursive

func ParseIERecursive(b []byte) (*IE, error)

ParseIERecursive parses given byte sequence as an IE.

func ParseMultiIEs

func ParseMultiIEs(b []byte) ([]*IE, error)

ParseMultiIEs parses multiple (unspecified number of) IEs to []*IE at a time.

func (*IE) MarshalBinary

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

MarshalBinary returns the byte sequence generated from a IE instance.

func (*IE) MarshalLen

func (i *IE) MarshalLen() int

MarshalLen returns the serial length of IE.

func (*IE) MarshalTo

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

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

func (*IE) ParseRecursive

func (i *IE) ParseRecursive(b []byte) error

ParseRecursive sets the values retrieved from byte sequence in an IE.

func (*IE) SetLength

func (i *IE) SetLength()

SetLength sets the length in Length field.

func (*IE) String

func (i *IE) String() string

String returns IE in human readable string.

func (*IE) UnmarshalBinary

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

UnmarshalBinary sets the values retrieved from byte sequence in an IE.

type InvalidCodeError

type InvalidCodeError struct {
	Code int
}

InvalidCodeError indicates that Code in TCAP message is invalid.

func (*InvalidCodeError) Error

func (e *InvalidCodeError) Error() string

Error returns error message with violating content.

type TCAP

type TCAP struct {
	Transaction *Transaction
	Dialogue    *Dialogue
	Components  *Components
}

TCAP represents a General Structure of TCAP Information Elements.

func NewBeginInvoke

func NewBeginInvoke(otid uint32, invID, opCode int, payload []byte) *TCAP

NewBeginInvoke creates a new TCAP of type Transaction=Begin, Component=Invoke.

func NewBeginInvokeWithDialogue

func NewBeginInvokeWithDialogue(otid uint32, dlgType, ctx, ctxver uint8, invID, opCode int, payload []byte) *TCAP

NewBeginInvokeWithDialogue creates a new TCAP of type Transaction=Begin, Component=Invoke with Dialogue Portion.

func NewContinueInvoke

func NewContinueInvoke(otid, dtid uint32, invID, opCode int, payload []byte) *TCAP

NewContinueInvoke creates a new TCAP of type Transaction=Continue, Component=Invoke.

func NewEndReturnResult

func NewEndReturnResult(dtid uint32, invID, opCode int, isLast bool, payload []byte) *TCAP

NewEndReturnResult creates a new TCAP of type Transaction=End, Component=ReturnResult.

func NewEndReturnResultWithDialogue

func NewEndReturnResultWithDialogue(dtid uint32, dlgType, ctx, ctxver uint8, invID, opCode int, isLast bool, payload []byte) *TCAP

NewEndReturnResultWithDialogue creates a new TCAP of type Transaction=End, Component=ReturnResult with Dialogue Portion.

func Parse

func Parse(b []byte) (*TCAP, error)

Parse parses given byte sequence as a TCAP.

func ParseBER

func ParseBER(b []byte) ([]*TCAP, error)

ParseBER parses given byte sequence as a TCAP.

func ParseBer deprecated

func ParseBer(b []byte) ([]*TCAP, error)

ParseBer parses given byte sequence as a TCAP.

Deprecated: use ParseBER instead.

func (*TCAP) AppContextName

func (t *TCAP) AppContextName() string

AppContextName returns the ACN in string.

func (*TCAP) AppContextNameOid

func (t *TCAP) AppContextNameOid() string

AppContextNameOid returns the ACN with ACN Version in OID formatted string.

TODO: Looking for a better way to return the value in the same format...

func (*TCAP) AppContextNameWithVersion

func (t *TCAP) AppContextNameWithVersion() string

AppContextNameWithVersion returns the ACN with ACN Version in string.

TODO: Looking for a better way to return the value in the same format...

func (*TCAP) ComponentType

func (t *TCAP) ComponentType() []string

ComponentType returns the ComponentType in Component Portion in the list of string.

The returned value is of type []string, as it may have multiple Components.

func (*TCAP) DTID

func (t *TCAP) DTID() uint32

DTID returns the TCAP Originating Transaction ID in Transaction Portion in uint32.

func (*TCAP) InvokeID

func (t *TCAP) InvokeID() []uint8

InvokeID returns the InvokeID in Component Portion in the list of string.

The returned value is of type []string, as it may have multiple Components.

func (*TCAP) LayerPayload

func (t *TCAP) LayerPayload() [][]byte

LayerPayload returns the upper layer as byte slice.

The returned value is of type [][]byte, as it may have multiple Components.

func (*TCAP) MarshalBinary

func (t *TCAP) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a TCAP instance.

func (*TCAP) MarshalLen

func (t *TCAP) MarshalLen() int

MarshalLen returns the serial length of TCAP.

func (*TCAP) MarshalTo

func (t *TCAP) MarshalTo(b []byte) error

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

func (*TCAP) OTID

func (t *TCAP) OTID() uint32

OTID returns the TCAP Originating Transaction ID in Transaction Portion in uint32.

func (*TCAP) OpCode

func (t *TCAP) OpCode() []uint8

OpCode returns the OpCode in Component Portion in the list of string.

The returned value is of type []string, as it may have multiple Components.

func (*TCAP) SetLength

func (t *TCAP) SetLength()

SetLength sets the length in Length field.

func (*TCAP) String

func (t *TCAP) String() string

String returns TCAP in human readable string.

func (*TCAP) UnmarshalBinary

func (t *TCAP) UnmarshalBinary(b []byte) error

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

type Tag

type Tag uint8

Tag is a Tag in TCAP IE

func NewApplicationWideConstructorTag

func NewApplicationWideConstructorTag(code int) Tag

NewApplicationWideConstructorTag creates a new NewApplicationWideConstructorTag.

func NewApplicationWidePrimitiveTag

func NewApplicationWidePrimitiveTag(code int) Tag

NewApplicationWidePrimitiveTag creates a new NewApplicationWidePrimitiveTag.

func NewContextSpecificConstructorTag

func NewContextSpecificConstructorTag(code int) Tag

NewContextSpecificConstructorTag creates a new NewContextSpecificConstructorTag.

func NewContextSpecificPrimitiveTag

func NewContextSpecificPrimitiveTag(code int) Tag

NewContextSpecificPrimitiveTag creates a new NewContextSpecificPrimitiveTag.

func NewPrivateConstructorTag

func NewPrivateConstructorTag(code int) Tag

NewPrivateConstructorTag creates a new NewPrivateConstructorTag.

func NewPrivatePrimitiveTag

func NewPrivatePrimitiveTag(code int) Tag

NewPrivatePrimitiveTag creates a new NewPrivatePrimitiveTag.

func NewTag

func NewTag(cls, form, code int) Tag

NewTag creates a new Tag.

func NewUniversalConstructorTag

func NewUniversalConstructorTag(code int) Tag

NewUniversalConstructorTag creates a new NewUniversalConstructorTag.

func NewUniversalPrimitiveTag

func NewUniversalPrimitiveTag(code int) Tag

NewUniversalPrimitiveTag creates a new NewUniversalPrimitiveTag.

func (Tag) Class

func (t Tag) Class() int

Class returns the Class retieved from a Tag.

func (Tag) Code

func (t Tag) Code() int

Code returns the Code retieved from a Tag.

func (Tag) Form

func (t Tag) Form() int

Form returns the Form retieved from a Tag.

type Transaction

type Transaction struct {
	Type              Tag
	Length            uint8
	OrigTransactionID *IE
	DestTransactionID *IE
	PAbortCause       *IE
	Payload           []byte
}

Transaction represents a Transaction Portion of TCAP.

func NewAbort

func NewAbort(dtid uint32, cause uint8, payload []byte) *Transaction

NewAbort returns Abort type of Transacion Portion.

func NewBegin

func NewBegin(otid uint32, payload []byte) *Transaction

NewBegin returns Begin type of Transacion Portion.

func NewContinue

func NewContinue(otid, dtid uint32, payload []byte) *Transaction

NewContinue returns Continue type of Transacion Portion.

func NewEnd

func NewEnd(otid uint32, payload []byte) *Transaction

NewEnd returns End type of Transacion Portion.

func NewTransaction

func NewTransaction(mtype int, otid, dtid uint32, cause uint8, payload []byte) *Transaction

NewTransaction returns a new Transaction Portion.

func NewUnidirectional

func NewUnidirectional(payload []byte) *Transaction

NewUnidirectional returns Unidirectional type of Transacion Portion.

func ParseTransaction

func ParseTransaction(b []byte) (*Transaction, error)

ParseTransaction parses given byte sequence as an Transaction.

func (*Transaction) AbortCause

func (t *Transaction) AbortCause() string

AbortCause returns the P-Abort Cause in string.

func (*Transaction) DTID

func (t *Transaction) DTID() string

DTID returns the DestTransactionID in string.

func (*Transaction) MarshalBinary

func (t *Transaction) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte sequence generated from a Transaction instance.

func (*Transaction) MarshalLen

func (t *Transaction) MarshalLen() int

MarshalLen returns the serial length of Transaction.

func (*Transaction) MarshalTo

func (t *Transaction) MarshalTo(b []byte) error

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

func (*Transaction) MessageTypeString

func (t *Transaction) MessageTypeString() string

MessageTypeString returns the name of Message Type in string.

func (*Transaction) OTID

func (t *Transaction) OTID() string

OTID returns the OrigTransactionID in string.

func (*Transaction) SetLength

func (t *Transaction) SetLength()

SetLength sets the length in Length field.

func (*Transaction) SetValsFrom

func (t *Transaction) SetValsFrom(berParsed *IE) error

SetValsFrom sets the values from IE parsed by ParseBER.

func (*Transaction) String

func (t *Transaction) String() string

String returns Transaction in human readable string.

func (*Transaction) UnmarshalBinary

func (t *Transaction) UnmarshalBinary(b []byte) error

UnmarshalBinary sets the values retrieved from byte sequence in an Transaction.

Directories

Path Synopsis
examples
client
Command client creates Begin/Invoke packet with given parameters, and send it to the specified address.
Command client creates Begin/Invoke packet with given parameters, and send it to the specified address.

Jump to

Keyboard shortcuts

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