Loading Client.cfg 0 → 100644 +31 −0 Original line number Diff line number Diff line [LOGGING] FileMask := LOG_ALL | TTCN_ERROR | TTCN_USER | MATCHING | TTCN_DEBUG #|LOG_ALL | TTCN_WARNING | TTCN_TESTCASE | TTCN_STATISTICS | TTCN_PORTEVENT ConsoleMask := TTCN_ERROR | TTCN_USER #| TTCN_PORTEVENT LogSourceInfo := Yes TimeStampFormat := DateTime LogEventTypes := Yes SourceInfoFormat := Single LogSourceInfo := Yes [MODULE_PARAMETERS] TCPTest.px_ClientAddr := "192.168.178.35"; // "127.0.0.1"; //"10.0.2.15"; // VM TCPTest.px_ServerAddr := "192.168.178.35"; TCPTest.px_ClientPort := 50060; TCPTest.px_ServerPort := 5060; [TESTPORT_PARAMETERS] *.tcpPort.mode := "advanced" //*.tcpPort.mode := "basic" *.tcpPort.debugging := "yes" *.tcpPort.use_connection_ASPs := "yes" [EXECUTE] TCPTest.TC_Client //TCPTest.TC_Server Makefile 0 → 100644 +195 −0 Original line number Diff line number Diff line # This Makefile was generated by the Makefile Generator # of the TTCN-3 Test Executor version 11.1.0 (5e9dc3607-dirty) # for Olaf Alejandro Bergengruen (olaf@olaf-dell6) on Tue Feb 10 00:51:30 2026 # Copyright (c) 2000-2025 Ericsson Telecom AB # The following make commands are available: # - make, make all Builds the executable test suite. # - make archive Archives all source files. # - make check Checks the semantics of TTCN-3 and ASN.1modules. # - make port Generates test port and external class skeletons. # - make clean Removes all generated files. # - make compile Translates TTCN-3 and ASN.1 modules to C++. # - make dep Creates/updates dependency list. # - make executable Builds the executable test suite. # - make library Builds the library archive. # - make objects Builds the object files without linking the executable. # # Set these variables... # ifndef TTCN3_DIR ifneq (,$(wildcard /usr/include/titan/)) TTCN3_DIR = /usr TTCN3_SUBDIR = /titan else TTCN3_DIR = TTCN3_SUBDIR = endif endif # Your platform: (SOLARIS, SOLARIS8, LINUX, FREEBSD or WIN32) PLATFORM = LINUX # Your C++ compiler: # (if you change the platform, you may need to change the compiler) CXX = g++ # Flags for the C++ preprocessor (and makedepend as well): CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include$(TTCN3_SUBDIR) # Flags for the C++ compiler: CXXFLAGS = -Wall # Flags for the linker: LDFLAGS = ifeq ($(PLATFORM), WIN32) # Silence linker warnings. LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc endif # Utility to create library files AR = ar ARFLAGS = # Flags for the TTCN-3 and ASN.1 compiler: COMPILER_FLAGS = -L # Execution mode: (either ttcn3 or ttcn3-parallel) TTCN3_LIB = ttcn3 # Lib folder of OpenSSL installation: (lib or lib64) OPENSSL_LIB_DIR = lib # The path of your libxml2 installation: # If you do not have your own one, leave it unchanged. XMLDIR = $(TTCN3_DIR) # Directory to store the archived source files: # Note: you can set any directory except ./archive ARCHIVE_DIR = backup # # You may change these variables. Add your files if necessary... # # TTCN-3 modules of this project: TTCN3_MODULES = SCTPasp_PortType.ttcn SCTPasp_Types.ttcn SCTPTest.ttcn # ASN.1 modules of this project: ASN1_MODULES = # C++ source & header files generated from the TTCN-3 & ASN.1 modules of # this project: GENERATED_SOURCES = SCTPasp_PortType.cc SCTPasp_Types.cc SCTPTest.cc GENERATED_HEADERS = SCTPasp_PortType.hh SCTPasp_Types.hh SCTPTest.hh # C/C++ Source & header files of Test Ports, external functions and # other modules: USER_SOURCES = SCTPasp_PT.cc USER_HEADERS = SCTPasp_PT.hh # Object files of this project that are needed for the executable test suite: OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS) GENERATED_OBJECTS = SCTPasp_PortType.o SCTPasp_Types.o SCTPTest.o USER_OBJECTS = SCTPasp_PT.o # Other files of the project (Makefile, configuration files, etc.) # that will be added to the archived source files: OTHER_FILES = Makefile # The name of the executable test suite: EXECUTABLE = SCTPTest LIBRARY = lib$(EXECUTABLE).a TARGET = $(EXECUTABLE) # # Do not modify these unless you know what you are doing... # Platform specific additional libraries: # SOLARIS_LIBS = -lsocket -lnsl -lxml2 SOLARIS8_LIBS = -lsocket -lnsl -lxml2 LINUX_LIBS = -lxml2 -lpthread FREEBSD_LIBS = -lxml2 WIN32_LIBS = -lxml2 # # Rules for building the executable... # all: $(TARGET) ; executable: $(EXECUTABLE) ; library: $(LIBRARY) ; objects: $(OBJECTS) compile; $(EXECUTABLE): $(OBJECTS) if $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) \ -L$(TTCN3_DIR)/lib$(TTCN3_SUBDIR) -l$(TTCN3_LIB) \ -L$(OPENSSL_DIR)/$(OPENSSL_LIB_DIR) -lcrypto \ -L$(XMLDIR)/lib $($(PLATFORM)_LIBS); \ then : ; else $(TTCN3_DIR)/bin/titanver $(OBJECTS); exit 1; fi $(LIBRARY): $(OBJECTS) $(AR) -r $(ARFLAGS) $(LIBRARY) $(OBJECTS) .cc.o .c.o: $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile @if [ ! -f $@ ]; then rm -f compile; $(MAKE) compile; fi check: $(TTCN3_MODULES) $(ASN1_MODULES) $(TTCN3_DIR)/bin/compiler -s $(COMPILER_FLAGS) \ $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) port: $(TTCN3_MODULES) $(ASN1_MODULES) $(TTCN3_DIR)/bin/compiler -t $(COMPILER_FLAGS) \ $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) compile: $(TTCN3_MODULES) $(ASN1_MODULES) $(TTCN3_DIR)/bin/compiler $(COMPILER_FLAGS) \ $(TTCN3_MODULES) $(ASN1_MODULES) - $? touch $@ clean: -rm -f $(EXECUTABLE) $(LIBRARY) $(OBJECTS) -rm -f $(GENERATED_HEADERS) -rm -f $(GENERATED_SOURCES) -rm -f tags *.log -rm -f compile dep: $(GENERATED_SOURCES) $(USER_SOURCES) ; makedepend $(CPPFLAGS) -DMAKEDEPEND_RUN $(GENERATED_SOURCES) $(USER_SOURCES) archive: mkdir -p $(ARCHIVE_DIR) tar -cvhf - $(TTCN3_MODULES) $(ASN1_MODULES) \ $(USER_HEADERS) $(USER_SOURCES) $(OTHER_FILES) \ | gzip >$(ARCHIVE_DIR)/`basename $(TARGET) .exe`-`date '+%y%m%d-%H%M'`.tgz diag: $(TTCN3_DIR)/bin/compiler -v 2>&1 $(TTCN3_DIR)/bin/mctr_cli -v 2>&1 $(CXX) -v 2>&1 $(AR) -V 2>&1 @echo TTCN3_DIR=$(TTCN3_DIR) @echo OPENSSL_DIR=$(OPENSSL_DIR) @echo OPENSSL_LIB_DIR=$(OPENSSL_LIB_DIR) @echo XMLDIR=$(XMLDIR) @echo PLATFORM=$(PLATFORM) # # Add your rules here if necessary... # ReadMe.md +5 −6 Original line number Diff line number Diff line # SCTPTest # SCTPTest mini project ## Overview Initial, simple experiments with sending/ receiving SCTP messages within TTCN code using Titan's SCTP ASPs. There is a server and a client test wihch can run on different hosts. There is a server and a client test which can run on different hosts. Olaf Bergengruen, January 2026 ## References - Titan compiler - SCTPasp repository and documentation in the Titan repository page: - See SCTPasp repository and documentation in the Titan repository page: https://gitlab.eclipse.org/eclipse/titan Loading @@ -35,3 +32,5 @@ Run the server on host A: Then run the client on host B: ./SCTPTest Client.cfg Have fun! SCTPTest.ttcn 0 → 100644 +216 −0 Original line number Diff line number Diff line /* Example for a simple test system over SCTP using Titan and * the Titan SCTPasps. * * Olaf Bergengruen, January 2026 */ module SCTPTest { import from SCTPasp_Types all; import from SCTPasp_PortType all; modulepar { charstring px_ClientAddr; charstring px_ServerAddr; integer px_ClientPort; integer px_ServerPort; }; type component TestComponent { // Used by the client test to connect to a server port SCTPasp_PT clientPort; // Used by the server test to receive client messages port SCTPasp_PT serverPort; }; // ---------------------------------- template (value) ASP_SCTP cs_SCTP (template (omit) integer p_ClientId, integer p_stream, integer p_ppid, octetstring p_PDU) := { client_id := p_ClientId, sinfo_stream := p_stream, sinfo_ppid := p_ppid, data := p_PDU }; template ASP_SCTP cr_SCTP := { client_id := *, sinfo_stream := ?, sinfo_ppid := ?, data := ? }; template (value) ASP_SCTP_Listen cs_SCTP_Listen (charstring p_HostName, integer p_LocalPort) := { local_hostname := p_HostName, local_portnumber := p_LocalPort }; template (value) ASP_SCTP_Connect cs_SCTP_Connect (charstring p_RemoteHost, integer p_RemotePort) := { peer_hostname := p_RemoteHost, peer_portnumber := p_RemotePort }; template ASP_SCTP_RESULT cr_SCTP_Connect_result := { client_id := ?, error_status := false, error_message := omit }; template (value) ASP_SCTP_Close cs_SCTP_Close (integer p_Id) := { client_id := p_Id }; template ASP_SCTP_SHUTDOWN_EVENT cr_SCTP_Shutdown := { client_id := ? }; template ASP_SCTP_Connected cr_SCTP_Connected := { client_id := ?, local_hostname := ?, local_portnumber := ?, peer_hostname := ?, peer_portnumber := ? }; // ------------------------- const octetstring tsc_HelloServer := char2oct("Hello Server!"); const octetstring tsc_HelloClient := char2oct("Hello Client!"); const octetstring tsc_HelloFromServer := char2oct("Hello Client!"); const octetstring tsc_HelloFromClient := char2oct("Hello Server!"); // -------------------------- testcase TC_Client() runs on TestComponent { var ASP_SCTP_RESULT v_ConnectResult; var ASP_SCTP v_SCTP; var ASP_SCTP_SHUTDOWN_EVENT v_SCTP_Shutdown; var boolean b_SCTPConnected := false; var octetstring v_Oct; timer t1; timer tc_timer := 2.0; map(mtc:clientPort, system:clientPort); log("SCTP client trying to contact " & px_ServerAddr & ": " & int2str(px_ServerPort)); tc_timer.start; clientPort.send(cs_SCTP_Connect(px_ServerAddr, px_ServerPort)); alt { [] clientPort.receive( cr_SCTP_Connect_result) -> value v_ConnectResult { log("Connected"); b_SCTPConnected := true; setverdict(pass); } [] tc_timer.timeout { log("*** timeout"); testcase.stop; } } clientPort.send(cs_SCTP(omit, 0, 0, tsc_HelloServer)); log ("Msg sent to server, waiting for response..."); alt { [] clientPort.receive( cr_SCTP) -> value v_SCTP { log("Received from server: " & oct2char(v_SCTP.data)); setverdict(pass); } [] clientPort.receive(cr_SCTP_Shutdown) -> value v_SCTP_Shutdown { log("STCP connection closed unexpectedly."); b_SCTPConnected := false; setverdict(fail); } } if (b_SCTPConnected) { clientPort.send(cs_SCTP_Close(v_ConnectResult.client_id)); t1.start(0.5); t1.timeout; log("Close STCP connection"); } if (getverdict == pass) { log("TC_Client: PASS"); } else { log("TC_Client: FAIL"); } } // TC_Client testcase TC_Server() runs on TestComponent { var ASP_SCTP v_SCTP; var ASP_SCTP_Connected v_SCTP_Connection; //var ASP_TCP_Listen_result v_ListenResult; timer t1 := 1.0; var octetstring v_Oct; map(mtc:serverPort, system:serverPort); log("@@@1"); // Listen on server port serverPort.send(cs_SCTP_Listen(px_ServerAddr, px_ServerPort)); log("I am the SCTP server listening at " & px_ServerAddr & " at port " & int2str(px_ServerPort)); alt { [] serverPort.receive( cr_SCTP_Connected) -> value v_SCTP_Connection { log(v_SCTP_Connection); } } alt { [] serverPort.receive( cr_SCTP) -> value v_SCTP { setverdict(pass); log("Received from Client " & oct2char(v_SCTP.data)); } } serverPort.send(cs_SCTP(v_SCTP_Connection.client_id, 0, 0, tsc_HelloServer)); // Finally close the connection t1.start; t1.timeout; serverPort.send(cs_SCTP_Close(v_SCTP_Connection.client_id)); if (getverdict == pass) { log("TC_Server: PASS"); } else { log("TC_Server: FAIL"); } }// TC_Server } Server.cfg 0 → 100644 +32 −0 Original line number Diff line number Diff line [LOGGING] FileMask := LOG_ALL | TTCN_ERROR | TTCN_USER | MATCHING | TTCN_DEBUG #|LOG_ALL | TTCN_WARNING | TTCN_TESTCASE | TTCN_STATISTICS | TTCN_PORTEVENT ConsoleMask := TTCN_ERROR | TTCN_USER #| TTCN_PORTEVENT LogSourceInfo := Yes TimeStampFormat := DateTime LogEventTypes := Yes SourceInfoFormat := Single LogSourceInfo := Yes [MODULE_PARAMETERS] SCTPTest.px_ClientAddr := "192.168.178.42"; SCTPTest.px_ServerAddr := "192.168.178.42"; SCTPTest.px_ClientPort := 50031; SCTPTest.px_ServerPort := 50030; [TESTPORT_PARAMETERS] *.serverPort.simple_mode := "yes" *.serverPort.server_mode := "yes" *.serverPort.local_IP_address := "192.168.178.42" *.serverPort.local_port := "50030" [EXECUTE] SCTPTest.TC_Server Loading
Client.cfg 0 → 100644 +31 −0 Original line number Diff line number Diff line [LOGGING] FileMask := LOG_ALL | TTCN_ERROR | TTCN_USER | MATCHING | TTCN_DEBUG #|LOG_ALL | TTCN_WARNING | TTCN_TESTCASE | TTCN_STATISTICS | TTCN_PORTEVENT ConsoleMask := TTCN_ERROR | TTCN_USER #| TTCN_PORTEVENT LogSourceInfo := Yes TimeStampFormat := DateTime LogEventTypes := Yes SourceInfoFormat := Single LogSourceInfo := Yes [MODULE_PARAMETERS] TCPTest.px_ClientAddr := "192.168.178.35"; // "127.0.0.1"; //"10.0.2.15"; // VM TCPTest.px_ServerAddr := "192.168.178.35"; TCPTest.px_ClientPort := 50060; TCPTest.px_ServerPort := 5060; [TESTPORT_PARAMETERS] *.tcpPort.mode := "advanced" //*.tcpPort.mode := "basic" *.tcpPort.debugging := "yes" *.tcpPort.use_connection_ASPs := "yes" [EXECUTE] TCPTest.TC_Client //TCPTest.TC_Server
Makefile 0 → 100644 +195 −0 Original line number Diff line number Diff line # This Makefile was generated by the Makefile Generator # of the TTCN-3 Test Executor version 11.1.0 (5e9dc3607-dirty) # for Olaf Alejandro Bergengruen (olaf@olaf-dell6) on Tue Feb 10 00:51:30 2026 # Copyright (c) 2000-2025 Ericsson Telecom AB # The following make commands are available: # - make, make all Builds the executable test suite. # - make archive Archives all source files. # - make check Checks the semantics of TTCN-3 and ASN.1modules. # - make port Generates test port and external class skeletons. # - make clean Removes all generated files. # - make compile Translates TTCN-3 and ASN.1 modules to C++. # - make dep Creates/updates dependency list. # - make executable Builds the executable test suite. # - make library Builds the library archive. # - make objects Builds the object files without linking the executable. # # Set these variables... # ifndef TTCN3_DIR ifneq (,$(wildcard /usr/include/titan/)) TTCN3_DIR = /usr TTCN3_SUBDIR = /titan else TTCN3_DIR = TTCN3_SUBDIR = endif endif # Your platform: (SOLARIS, SOLARIS8, LINUX, FREEBSD or WIN32) PLATFORM = LINUX # Your C++ compiler: # (if you change the platform, you may need to change the compiler) CXX = g++ # Flags for the C++ preprocessor (and makedepend as well): CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include$(TTCN3_SUBDIR) # Flags for the C++ compiler: CXXFLAGS = -Wall # Flags for the linker: LDFLAGS = ifeq ($(PLATFORM), WIN32) # Silence linker warnings. LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc endif # Utility to create library files AR = ar ARFLAGS = # Flags for the TTCN-3 and ASN.1 compiler: COMPILER_FLAGS = -L # Execution mode: (either ttcn3 or ttcn3-parallel) TTCN3_LIB = ttcn3 # Lib folder of OpenSSL installation: (lib or lib64) OPENSSL_LIB_DIR = lib # The path of your libxml2 installation: # If you do not have your own one, leave it unchanged. XMLDIR = $(TTCN3_DIR) # Directory to store the archived source files: # Note: you can set any directory except ./archive ARCHIVE_DIR = backup # # You may change these variables. Add your files if necessary... # # TTCN-3 modules of this project: TTCN3_MODULES = SCTPasp_PortType.ttcn SCTPasp_Types.ttcn SCTPTest.ttcn # ASN.1 modules of this project: ASN1_MODULES = # C++ source & header files generated from the TTCN-3 & ASN.1 modules of # this project: GENERATED_SOURCES = SCTPasp_PortType.cc SCTPasp_Types.cc SCTPTest.cc GENERATED_HEADERS = SCTPasp_PortType.hh SCTPasp_Types.hh SCTPTest.hh # C/C++ Source & header files of Test Ports, external functions and # other modules: USER_SOURCES = SCTPasp_PT.cc USER_HEADERS = SCTPasp_PT.hh # Object files of this project that are needed for the executable test suite: OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS) GENERATED_OBJECTS = SCTPasp_PortType.o SCTPasp_Types.o SCTPTest.o USER_OBJECTS = SCTPasp_PT.o # Other files of the project (Makefile, configuration files, etc.) # that will be added to the archived source files: OTHER_FILES = Makefile # The name of the executable test suite: EXECUTABLE = SCTPTest LIBRARY = lib$(EXECUTABLE).a TARGET = $(EXECUTABLE) # # Do not modify these unless you know what you are doing... # Platform specific additional libraries: # SOLARIS_LIBS = -lsocket -lnsl -lxml2 SOLARIS8_LIBS = -lsocket -lnsl -lxml2 LINUX_LIBS = -lxml2 -lpthread FREEBSD_LIBS = -lxml2 WIN32_LIBS = -lxml2 # # Rules for building the executable... # all: $(TARGET) ; executable: $(EXECUTABLE) ; library: $(LIBRARY) ; objects: $(OBJECTS) compile; $(EXECUTABLE): $(OBJECTS) if $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) \ -L$(TTCN3_DIR)/lib$(TTCN3_SUBDIR) -l$(TTCN3_LIB) \ -L$(OPENSSL_DIR)/$(OPENSSL_LIB_DIR) -lcrypto \ -L$(XMLDIR)/lib $($(PLATFORM)_LIBS); \ then : ; else $(TTCN3_DIR)/bin/titanver $(OBJECTS); exit 1; fi $(LIBRARY): $(OBJECTS) $(AR) -r $(ARFLAGS) $(LIBRARY) $(OBJECTS) .cc.o .c.o: $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile @if [ ! -f $@ ]; then rm -f compile; $(MAKE) compile; fi check: $(TTCN3_MODULES) $(ASN1_MODULES) $(TTCN3_DIR)/bin/compiler -s $(COMPILER_FLAGS) \ $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) port: $(TTCN3_MODULES) $(ASN1_MODULES) $(TTCN3_DIR)/bin/compiler -t $(COMPILER_FLAGS) \ $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) compile: $(TTCN3_MODULES) $(ASN1_MODULES) $(TTCN3_DIR)/bin/compiler $(COMPILER_FLAGS) \ $(TTCN3_MODULES) $(ASN1_MODULES) - $? touch $@ clean: -rm -f $(EXECUTABLE) $(LIBRARY) $(OBJECTS) -rm -f $(GENERATED_HEADERS) -rm -f $(GENERATED_SOURCES) -rm -f tags *.log -rm -f compile dep: $(GENERATED_SOURCES) $(USER_SOURCES) ; makedepend $(CPPFLAGS) -DMAKEDEPEND_RUN $(GENERATED_SOURCES) $(USER_SOURCES) archive: mkdir -p $(ARCHIVE_DIR) tar -cvhf - $(TTCN3_MODULES) $(ASN1_MODULES) \ $(USER_HEADERS) $(USER_SOURCES) $(OTHER_FILES) \ | gzip >$(ARCHIVE_DIR)/`basename $(TARGET) .exe`-`date '+%y%m%d-%H%M'`.tgz diag: $(TTCN3_DIR)/bin/compiler -v 2>&1 $(TTCN3_DIR)/bin/mctr_cli -v 2>&1 $(CXX) -v 2>&1 $(AR) -V 2>&1 @echo TTCN3_DIR=$(TTCN3_DIR) @echo OPENSSL_DIR=$(OPENSSL_DIR) @echo OPENSSL_LIB_DIR=$(OPENSSL_LIB_DIR) @echo XMLDIR=$(XMLDIR) @echo PLATFORM=$(PLATFORM) # # Add your rules here if necessary... #
ReadMe.md +5 −6 Original line number Diff line number Diff line # SCTPTest # SCTPTest mini project ## Overview Initial, simple experiments with sending/ receiving SCTP messages within TTCN code using Titan's SCTP ASPs. There is a server and a client test wihch can run on different hosts. There is a server and a client test which can run on different hosts. Olaf Bergengruen, January 2026 ## References - Titan compiler - SCTPasp repository and documentation in the Titan repository page: - See SCTPasp repository and documentation in the Titan repository page: https://gitlab.eclipse.org/eclipse/titan Loading @@ -35,3 +32,5 @@ Run the server on host A: Then run the client on host B: ./SCTPTest Client.cfg Have fun!
SCTPTest.ttcn 0 → 100644 +216 −0 Original line number Diff line number Diff line /* Example for a simple test system over SCTP using Titan and * the Titan SCTPasps. * * Olaf Bergengruen, January 2026 */ module SCTPTest { import from SCTPasp_Types all; import from SCTPasp_PortType all; modulepar { charstring px_ClientAddr; charstring px_ServerAddr; integer px_ClientPort; integer px_ServerPort; }; type component TestComponent { // Used by the client test to connect to a server port SCTPasp_PT clientPort; // Used by the server test to receive client messages port SCTPasp_PT serverPort; }; // ---------------------------------- template (value) ASP_SCTP cs_SCTP (template (omit) integer p_ClientId, integer p_stream, integer p_ppid, octetstring p_PDU) := { client_id := p_ClientId, sinfo_stream := p_stream, sinfo_ppid := p_ppid, data := p_PDU }; template ASP_SCTP cr_SCTP := { client_id := *, sinfo_stream := ?, sinfo_ppid := ?, data := ? }; template (value) ASP_SCTP_Listen cs_SCTP_Listen (charstring p_HostName, integer p_LocalPort) := { local_hostname := p_HostName, local_portnumber := p_LocalPort }; template (value) ASP_SCTP_Connect cs_SCTP_Connect (charstring p_RemoteHost, integer p_RemotePort) := { peer_hostname := p_RemoteHost, peer_portnumber := p_RemotePort }; template ASP_SCTP_RESULT cr_SCTP_Connect_result := { client_id := ?, error_status := false, error_message := omit }; template (value) ASP_SCTP_Close cs_SCTP_Close (integer p_Id) := { client_id := p_Id }; template ASP_SCTP_SHUTDOWN_EVENT cr_SCTP_Shutdown := { client_id := ? }; template ASP_SCTP_Connected cr_SCTP_Connected := { client_id := ?, local_hostname := ?, local_portnumber := ?, peer_hostname := ?, peer_portnumber := ? }; // ------------------------- const octetstring tsc_HelloServer := char2oct("Hello Server!"); const octetstring tsc_HelloClient := char2oct("Hello Client!"); const octetstring tsc_HelloFromServer := char2oct("Hello Client!"); const octetstring tsc_HelloFromClient := char2oct("Hello Server!"); // -------------------------- testcase TC_Client() runs on TestComponent { var ASP_SCTP_RESULT v_ConnectResult; var ASP_SCTP v_SCTP; var ASP_SCTP_SHUTDOWN_EVENT v_SCTP_Shutdown; var boolean b_SCTPConnected := false; var octetstring v_Oct; timer t1; timer tc_timer := 2.0; map(mtc:clientPort, system:clientPort); log("SCTP client trying to contact " & px_ServerAddr & ": " & int2str(px_ServerPort)); tc_timer.start; clientPort.send(cs_SCTP_Connect(px_ServerAddr, px_ServerPort)); alt { [] clientPort.receive( cr_SCTP_Connect_result) -> value v_ConnectResult { log("Connected"); b_SCTPConnected := true; setverdict(pass); } [] tc_timer.timeout { log("*** timeout"); testcase.stop; } } clientPort.send(cs_SCTP(omit, 0, 0, tsc_HelloServer)); log ("Msg sent to server, waiting for response..."); alt { [] clientPort.receive( cr_SCTP) -> value v_SCTP { log("Received from server: " & oct2char(v_SCTP.data)); setverdict(pass); } [] clientPort.receive(cr_SCTP_Shutdown) -> value v_SCTP_Shutdown { log("STCP connection closed unexpectedly."); b_SCTPConnected := false; setverdict(fail); } } if (b_SCTPConnected) { clientPort.send(cs_SCTP_Close(v_ConnectResult.client_id)); t1.start(0.5); t1.timeout; log("Close STCP connection"); } if (getverdict == pass) { log("TC_Client: PASS"); } else { log("TC_Client: FAIL"); } } // TC_Client testcase TC_Server() runs on TestComponent { var ASP_SCTP v_SCTP; var ASP_SCTP_Connected v_SCTP_Connection; //var ASP_TCP_Listen_result v_ListenResult; timer t1 := 1.0; var octetstring v_Oct; map(mtc:serverPort, system:serverPort); log("@@@1"); // Listen on server port serverPort.send(cs_SCTP_Listen(px_ServerAddr, px_ServerPort)); log("I am the SCTP server listening at " & px_ServerAddr & " at port " & int2str(px_ServerPort)); alt { [] serverPort.receive( cr_SCTP_Connected) -> value v_SCTP_Connection { log(v_SCTP_Connection); } } alt { [] serverPort.receive( cr_SCTP) -> value v_SCTP { setverdict(pass); log("Received from Client " & oct2char(v_SCTP.data)); } } serverPort.send(cs_SCTP(v_SCTP_Connection.client_id, 0, 0, tsc_HelloServer)); // Finally close the connection t1.start; t1.timeout; serverPort.send(cs_SCTP_Close(v_SCTP_Connection.client_id)); if (getverdict == pass) { log("TC_Server: PASS"); } else { log("TC_Server: FAIL"); } }// TC_Server }
Server.cfg 0 → 100644 +32 −0 Original line number Diff line number Diff line [LOGGING] FileMask := LOG_ALL | TTCN_ERROR | TTCN_USER | MATCHING | TTCN_DEBUG #|LOG_ALL | TTCN_WARNING | TTCN_TESTCASE | TTCN_STATISTICS | TTCN_PORTEVENT ConsoleMask := TTCN_ERROR | TTCN_USER #| TTCN_PORTEVENT LogSourceInfo := Yes TimeStampFormat := DateTime LogEventTypes := Yes SourceInfoFormat := Single LogSourceInfo := Yes [MODULE_PARAMETERS] SCTPTest.px_ClientAddr := "192.168.178.42"; SCTPTest.px_ServerAddr := "192.168.178.42"; SCTPTest.px_ClientPort := 50031; SCTPTest.px_ServerPort := 50030; [TESTPORT_PARAMETERS] *.serverPort.simple_mode := "yes" *.serverPort.server_mode := "yes" *.serverPort.local_IP_address := "192.168.178.42" *.serverPort.local_port := "50030" [EXECUTE] SCTPTest.TC_Server