Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » SCTP support in Eclipse Titan part 1(SCTP, SCTPasp, SIGTRAN, SCTP client, NCAT, test port, simple mode)
SCTP support in Eclipse Titan part 1 [message #1821907] Sat, 22 February 2020 16:17
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1064
Registered: January 2015
Senior Member
Dear all,

time has come to shed some light over the support offered by Titan for SCTP. SCTP, or Stream Control Transmission Protocol, is a connection-oriented transport protocol, similar to TCP, but provides message-oriented data transfer, more like UDP.

The applications that derive the most benefit from the use of SCTP are in the voice and video communications, originating from the SIGTRAN and SIP areas. The Stream Control Transmission Protocol provides the transport protocol for SIGTRAN user adaptation layer messages across an IP network. SIGTRAN is the name, derived from signaling transport, of the former Internet Task Force working group that produced specifications for a family of protocols that provide reliable datagram service and
user layer adaptations for Signaling System and ISDN communications protocols. The SIGTRAN protocols are an extension of the SS7 protocol family.

The SIGTRAN protocol stack consists of 3 components(see RFC 2719):
-A standard IP layer.
-An SCTP layer: SCTP provides connection oriented reliable transfer of user messages between peer SCTP users (Adaptation layer protocols).
The SCTP layer replaces a regular TCP/UDP layer.
-An adaptation layer: Protocols defined for this layer are e.g. M2PA, M2UA, M3UA, and SUA.

The Stream Transmission Control Protocol (SCTP)

An SCTP association (a concept equivalent to a TCP connection) is built up as a four way handshake that takes place in the following order:

The client sends an INIT signal to the server to initiate an association.
On receipt of the INIT signal, the server sends an INIT-ACK response to the client. This INIT-ACK signal contains a state cookie. This state
cookie must contain a Message Authentication Code (MAC), along with a time stamp corresponding to the creation of the cookie, the life span of the
state cookie, and the information necessary to establish the association. The MAC is computed by the server based on a secret key only known to it.
On receipt of this INIT-ACK signal, the client sends a COOKIE-ECHO response, which just echoes the state cookie.
After verifying the authenticity of the state cookie using the secret key, the server then allocates the resources for the association, sends a
COOKIE-ACK response acknowledging the COOKIE-ECHO signal, and moves the association to ESTABLISHED state.
SCTP supports also graceful close of an active association upon request from the SCTP user. The following sequence of events occurs:

The client sends a SHUTDOWN signal to the server, which tells the server that the client is ready to close the connection.
The server responds by sending a SHUTDOWN-ACK acknowledgement.
The client then sends a SHUTDOWN-COMPLETE signal back to the server.
SCTP also supports abrupt close (ABORT signal) of an active association upon the request from the SCTP client or due to an error in the SCTP
stack. However, SCTP does not support half open connections. More information about the protocol and its internals can be found in RFC 4960.

For details , see for example:

https://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol
https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/network/sctp_intro.html
https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/network/sctp_startup.html
https://www.zytrax.com/tech/ss7/sigtran_intro.html

The SCTPasp test port

Let's start with the legacy SCTP port available at
https://github.com/eclipse/titan.TestPorts.SCTPasp

Although development of the test port is discontinued, if you only need the basic SCTP in a project or for quick prototyping you might be better off with this port due to its simplicity.
Not unlikely other ports in the Titan ecosystem, the port can work in two modes, "simple" and "normal". In "simple" mode all configuration parameters are taken from the config file, and they canot be changed during execution, while in "normal" mode the port can be reconfigured on the fly using appropriate ASPs.

First we'll examine an SCTP client in "simple" mode. As usual, the code offered is not of industrial strength, it's just a skeleton to
give you an approximate idea about the product usage.

As an SCTP server, we've used NCAT started as below:
ncat -l --sctp -vv -p 5202 


The port parameters used are:

[TESTPORT_PARAMETERS]
# Port in simple mode

system.SCTP_PCO.simple_mode := "yes"
system.SCTP_PCO.reconnect := "no"
system.SCTP_PCO.reconnect_max_attempts := "10"
system.SCTP_PCO.server_mode := "no"
system.SCTP_PCO.debug := "yes"
system.SCTP_PCO.server_backlog := "1"
system.SCTP_PCO.peer_IP_address := "127.0.0.1"
system.SCTP_PCO.peer_port := "5202"
system.SCTP_PCO.sinit_num_ostreams := "10"
system.SCTP_PCO.sinit_max_instreams := "10"
system.SCTP_PCO.sinit_max_attempts := "0"
system.SCTP_PCO.sinit_max_init_timeo := "0"
system.SCTP_PCO.sctp_association_event := "disabled"
system.SCTP_PCO.sctp_address_event := "disabled"
system.SCTP_PCO.sctp_send_failure_event := "disabled"
system.SCTP_PCO.sctp_peer_error_event := "disabled"
system.SCTP_PCO.sctp_shutdown_event := "disabled"
system.SCTP_PCO.sctp_partial_delivery_event := "disabled"
system.SCTP_PCO.sctp_adaption_layer_event := "disabled"



and the TTCN-3 code deployed:

module SCTP
{

// Test port in simple mode
// All config from the config file
// SCTP Server:  ncat -l --sctp -vv -p 5202



import from SCTPasp_Types all;
import from SCTPasp_PortType all;

type component SCTP_CT {

  port SCTPasp_PT        SCTP_PCO;
}

type component System_CT
{
   port SCTPasp_PT SCTP_PCO;
}

template  ASP_SCTP_Close  t_ASP_SCTP_Close(template integer p_clientId) := {client_id:=p_clientId};

template ASP_SCTP t_ASP_SCTP(charstring p_s) :=
{
  client_id := omit,
  sinfo_stream := 0,
  sinfo_ppid := 0,
  data := char2oct(p_s) 
}

//******************************************************
testcase tc_sctp0() runs on SCTP_CT system System_CT  {
//******************************************************
  timer t0:=1.0;
 
  map(self:SCTP_PCO, system:SCTP_PCO);

var  ASP_SCTP_Connect vl_connect0 :=
{
  peer_hostname:=omit,
  peer_portnumber:=omit
}

//Connect
SCTP_PCO.send(vl_connect0) ;
  t0.start;
  alt 
  {   
    []SCTP_PCO.receive(ASP_SCTP_RESULT:?) { }
    []t0.timeout { }
  }

//Send some payload
for (var integer i:=0;i<=9;i:=i+1)  { 
var charstring vl_s:=int2str(i)&"  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ"&"\n\r";

SCTP_PCO.send(t_ASP_SCTP(vl_s)) ;  
}
 
SCTP_PCO.send(t_ASP_SCTP("Client waiting for 1 second"&"\n\r")) ; 
 
 t0.start;
 t0.timeout;

SCTP_PCO.send(t_ASP_SCTP("Client sending close"&"\n\r")) ;
  
 
  SCTP_PCO.send(t_ASP_SCTP_Close(omit)) 
  t0.start;
  alt 
  {
    []SCTP_PCO.receive {}
    []t0.timeout {}
  }


unmap(self:SCTP_PCO, system:SCTP_PCO);

  all component.kill;
}

//******************************************************
control
//******************************************************

{
  execute( tc_sctp0());
}//endcontrol

}//endmodule



So what happens here is that we map the port, send a connect, then some arbitrary payload, ad finally we tear down the association.

The console log on the server side:
ncat -l --sctp -vv -p 5202 
Ncat: Version 7.31 ( https://nmap.org/ncat )
Ncat: Listening on :::5202
Ncat: Listening on 0.0.0.0:5202
Ncat: Connection from 127.0.0.1.
Ncat: Connection from 127.0.0.1:36580.
0  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
1  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
2  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
3  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
4  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
5  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
6  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
7  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
8  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
9  :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
Client waiting for 1 second
Client sending close
NCAT DEBUG: Closing connection.



The complete Titan log is attached.

The following snippet shows the port being mapped and initialized (based on the test port parameters in the config file, or in lack of these based
on default values) and the connection (well, association would be the right word, but old TCP habits die hard) established:
16:51:32.061928 SCTP.ttcn:43 Mapping port mtc:SCTP_PCO to system:SCTP_PCO.
16:51:32.062054 SCTP.ttcn:43 SCTPasp Test Port (SCTP_PCO): Calling user_map(SCTP_PCO).
16:51:32.062088 SCTP.ttcn:43 SCTPasp Test Port (SCTP_PCO): Running in CLIENT MODE.
16:51:32.062117 SCTP.ttcn:43 SCTPasp Test Port (SCTP_PCO): Leaving user_map().
16:51:32.062144 SCTP.ttcn:43 Port SCTP_PCO was mapped to system:SCTP_PCO.
16:51:32.062223 SCTP.ttcn:43 Map operation of mtc:SCTP_PCO to system:SCTP_PCO finished.
16:51:32.062271 SCTP.ttcn:52 Sent on SCTP_PCO to system @SCTPasp_Types.ASP_SCTP_Connect : { peer_hostname := omit, peer_portnumber := omit }
16:51:32.062306 SCTP.ttcn:52 SCTPasp Test Port (SCTP_PCO): Calling outgoing_send (ASP_SCTP_CONNECT).
16:51:32.062334 SCTP.ttcn:52 SCTPasp Test Port (SCTP_PCO): Creating SCTP socket.
16:51:32.062377 SCTP.ttcn:52 SCTPasp Test Port (SCTP_PCO): Setting SCTP socket options (initmsg).
16:51:32.062407 SCTP.ttcn:52 SCTPasp Test Port (SCTP_PCO): Setting SCTP socket options (events).
16:51:32.062437 SCTP.ttcn:52 SCTPasp Test Port (SCTP_PCO): Connecting to (127.0.0.1):(5202)
16:51:32.062591 SCTP.ttcn:52 Message enqueued on SCTP_PCO from system @SCTPasp_Types.ASP_SCTP_RESULT : { client_id := 6, error_status := false, 
error_message := omit } id 1
16:51:32.062640 SCTP.ttcn:52 SCTPasp Test Port (SCTP_PCO): Connection successfully established to (127.0.0.1):(5202)



On the attached Wireshark screenshot one can follow the establishment of the SCTP association,payload transfer (DATA chunks acknowledged by SACK-Selective Acknowledgement), heartbeat, teardown of the association.
index.php/fa/37428/0/
Compilation and execution was done on a Ubuntu 18.04 machine.

We'll continue with the SCTP port used in normal mode.


Best regards
Elemer

[Updated on: Sun, 23 February 2020 09:27]

Report message to a moderator

Previous Topic:Trouble getting SCTP to work with IPL4
Next Topic:SCTP support in Eclipse Titan part 2
Goto Forum:
  


Current Time: Mon Jul 13 08:38:41 GMT 2020

Powered by FUDForum. Page generated in 0.01654 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top