Giter Club home page Giter Club logo

go-tcap's Introduction

go-tcap

Simple TCAP implementation in the Go Programming Language.

CI status golangci-lint Go Reference GitHub

Package tcap provides simple and painless handling of TCAP (Transaction Capabilities Application Part) in SS7/SIGTRAN protocol stack, intended for Go developers to use.

Disclaimer

Though TCAP is an 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 while it also means that many of the features in TCAP are not supported yet.

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

Run go mod tidy in your project's directory to collect the required packages automatically.

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)

LICENSE

MIT

go-tcap's People

Contributors

bf-cortex avatar dependabot-preview[bot] avatar dependabot[bot] avatar linouxis9 avatar wmnsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-tcap's Issues

Failure on missing protocol version

It looks like if no protocol version is defined this function will fail to correctly process the rest of the bytes

go-tcap/dialogue-pdu.go

Lines 438 to 445 in 08bd257

func (d *DialoguePDU) parseAAREFromBytes(b []byte) error {
var err error
var offset = 2
d.ProtocolVersion, err = ParseIE(b[offset:])
if err != nil {
return err
}
offset += d.ProtocolVersion.MarshalLen()

ASN1 length long length issue.

ASN1 has 2 implementations for the data length.

  • short ( < 127 )
  • long ( > 127 )

then the IE value length is greater than 127 it still encodes/decodes the length in the shorter implementation thus not able to communicate with any other ASN1 service.

Sample project

I suggest to have simple client/server project for go-tcap package,
it will be easy to new comers to understand and use that package

how to run client

I am new to go and following your instruction to run client. I am getting this error below:
go-tcap/examples/client# ./client -h
bash: ./client: No such file or directory

Having trouble with doing a InitialDPArgs request (CAMELv2)

Hi, I'm not sure if I'm doing this incorrectly, but using the library, I am try to send the following HEX byte string that is ASN1 encoded.

307180016e83078313873881620385010a8a058493527008bb0580038090a39c01029f320836155030868778f0bf3417020100810791527088113046a309800736f50100f1026fbf35038301119f3605dad1c900079f3707915270881130469f38068170880804199f39080242100341402080

I was expecting that wireshark would be able to successfully decode the payload, but instead it failed
Expected,
image
But got the following,
image

Here is the code snippet I used to generate the tcapPayload...

	hexString := "307180016e83078313873881620385010a8a058493527008bb0580038090a39c01029f320836155030868778f0bf3417020100810791527088113046a309800736f50100f1026fbf35038301119f3605dad1c900079f3707915270881130469f38068170880804199f39080242100341402080"

	p, err := hex.DecodeString(hexString)
	if err != nil {
		fmt.Println("Error decoding hex string:", err)
		return
	}

	tcapPayload := tcap.NewBeginInvokeWithDialogue(
		uint32(*otid),     // OTID
		tcap.DialogueAsID, // DialogueType
		uint8(50),
		1, // ACN Version
		0, // Invoke Id
		0, // OpCode
		p, // Payload
	)

Am I missing a setting or flag to be set?

Any assistance will be greatly appreciated. I am fairly new to SCCP/TCAP/CAMELv2, so please excuse any ignorance or strange questions.

Many thanks,
Danie

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.