files added
diff --git a/src/STOMP_Types.ttcn b/src/STOMP_Types.ttcn
new file mode 100644
index 0000000..d665073
--- /dev/null
+++ b/src/STOMP_Types.ttcn
@@ -0,0 +1,154 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000-2017 Ericsson Telecom AB
+//
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+///////////////////////////////////////////////////////////////////////////////
+//
+// Contributors:
+// Elemer Lelik-initial implementation
+//
+//
+
+/*
+
+https://stomp.github.io/stomp-specification-1.2.html
+
+
+Augmented BNF
+
+NULL                = <US-ASCII null (octet 0)>
+LF                  = <US-ASCII line feed (aka newline) (octet 10)>
+CR                  = <US-ASCII carriage return (octet 13)>
+EOL                 = [CR] LF 
+OCTET               = <any 8-bit sequence of data>
+
+frame-stream        = 1*frame
+
+frame               = command EOL
+                      *( header EOL )
+                      EOL
+                      *OCTET
+                      NULL
+                      *( EOL )
+
+command             = client-command | server-command
+
+client-command      = "SEND"
+                      | "SUBSCRIBE"
+                      | "UNSUBSCRIBE"
+                      | "BEGIN"
+                      | "COMMIT"
+                      | "ABORT"
+                      | "ACK"
+                      | "NACK"
+                      | "DISCONNECT"
+                      | "CONNECT"
+                      | "STOMP"
+
+server-command      = "CONNECTED"
+                      | "MESSAGE"
+                      | "RECEIPT"
+                      | "ERROR"
+
+header              = header-name ":" header-value
+header-name         = 1*<any OCTET except CR or LF or ":">
+header-value        = *<any OCTET except CR or LF or ":">
+
+*/
+
+
+module STOMP_Types {
+
+external function enc_STOMP(in STOMPFrame frame) return charstring
+with { extension "prototype(convert) encode(TEXT)" };
+external function dec_STOMP(in charstring stream) return STOMPFrame
+with { extension "prototype(convert) decode(TEXT)" };
+
+function f_enc_stomp(in STOMPFrame frame)  return octetstring 
+{
+  var octetstring v_os:=char2oct(enc_STOMP(frame));
+  v_os:=substr(v_os,0,lengthof(v_os)-2)&'000D0A'O;//cut @@ and add NULL EOL;
+
+  //log("v_os   :",v_os)
+  return v_os
+}
+
+function f_dec_stomp(in octetstring stream)  return STOMPFrame 
+{
+
+  var STOMPFrame  v_frame;
+  var octetstring v_os;
+  var integer v_l:=lengthof(stream);
+
+  for(var integer i:=v_l-1;i>=0;i:=i-1)
+
+  {
+
+     if(stream[i]=='00'O) {
+      v_os:=substr(stream,0,i)&'4040'O;//add @
+    }//endif 
+  }//endfor
+
+  //log("v_os   :",v_os)
+
+  v_frame:=dec_STOMP(oct2char(v_os));
+
+  return v_frame;
+}
+
+
+type charstring MyCharstringType ( pattern  "(([\q{0,0,0,14}-9]|[;-}])#(1,))" );
+
+
+type record Header {
+  MyCharstringType header_name,
+  MyCharstringType header_value
+}with {
+  variant "SEPARATOR(':',,)" 
+  variant "END('\r\n','(\r)#(0,1)\n',)"  //EOL
+}
+
+
+type record of Header Headers with {
+  variant "END('\r\n','(\r)#(0,1)\n',)"  //EOL
+} 
+
+type record STOMPFrame {
+
+  Command     command,
+  Headers     headers,
+  charstring  payload optional
+
+}with {
+  variant  "END('@@','[\q{0,0,0,64}]#(2,2)',)"
+} 
+
+type enumerated Command {
+  SEND,
+  SUBSCRIBE,
+  UNSUBSCRIBE, 
+  BEGIN,   
+  COMMIT, 
+  ABORT,
+  ACK,    
+  NACK,   
+  DISCONNECT, 
+  CONNECTED,   
+  CONNECT,   
+  STOMP,     
+  MESSAGE,      
+  RECEIPT,
+  ERROR  
+}
+with {
+  variant "END('\r\n','(\r)#(0,1)\n',)"  //EOL
+
+} 
+
+}with { encode "TEXT" } 
+
+
diff --git a/src/STOMP_common.ttcn b/src/STOMP_common.ttcn
new file mode 100644
index 0000000..5c88bc0
--- /dev/null
+++ b/src/STOMP_common.ttcn
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000-2017 Ericsson Telecom AB
+//
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+///////////////////////////////////////////////////////////////////////////////
+//
+// Contributors:
+// Elemer Lelik-initial implementation
+//
+//
+//This function permits extracting JSON messages from a TCP stream by calculating the message length
+//
+
+module STOMP_common
+{
+
+//-----------------------------------------------------------------------------
+//External functions
+//-----------------------------------------------------------------------------
+
+external function f_calc_STOMP_length(  in octetstring data) return integer;
+
+}
+
+
diff --git a/src/STOMP_slicer.cc b/src/STOMP_slicer.cc
new file mode 100644
index 0000000..8b81427
--- /dev/null
+++ b/src/STOMP_slicer.cc
@@ -0,0 +1,55 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000-2017 Ericsson Telecom AB
+//
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+///////////////////////////////////////////////////////////////////////////////
+//
+// Contributors:
+// Elemer Lelik-initial implementation
+//
+//
+//This function permits extracting JSON messages from a TCP stream by calculating the message length
+//
+
+#include "STOMP_common.hh"
+#include <ctype.h>
+#include <string.h>
+#include <iostream>
+
+namespace STOMP__common {
+//returns length of first STOMP string in the input stream, calculated from index 0, or -1 in case of unsuccessful match 
+INTEGER f__calc__STOMP__length(const OCTETSTRING& data){
+  int data_length=data.lengthof();
+  const unsigned char* ptr=(const unsigned char*)data;
+
+ 
+  for(int i=0; i<data_length; i++){
+
+             if (ptr[i] == '\0')
+        {
+         if(  (ptr[i+1] != '\n') &&  (ptr[i+1] != '\r') ) return i+1;
+        else {
+
+
+		 for(int j=i+1; j<data_length; j++){
+
+			if  (  (ptr[j+1] != '\n') &&  (ptr[j+1] != '\r') ) return j+1;
+
+		}//endfor
+
+
+        	}//endelse
+    
+        }//endif
+        
+  }//endfor
+
+  return -1;
+}//endfunction
+
+}//end ns
+
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..3ed4e7d
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,187 @@
+# This Makefile was generated by the Makefile Generator
+# of the TTCN-3 Test Executor version CRL 113 200/6 R2A
+# for Elemer Lelik (ethlel@esekilxxen1844) on Tue Jun 27 13:27:38 2017
+
+# Copyright (c) 2000-2017 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 port 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...
+#
+
+# The path of your TTCN-3 Test Executor installation:
+# Uncomment this line to override the environment variable.
+# TTCN3_DIR = 
+
+# 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
+
+# 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-parallel
+
+# The path of your OpenSSL installation:
+# If you do not have your own one, leave it unchanged.
+OPENSSL_DIR = $(TTCN3_DIR)
+
+# 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 = STOMP_Types.ttcn STOMP_test.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 = STOMP_Types.cc STOMP_test.cc
+GENERATED_HEADERS = STOMP_Types.hh STOMP_test.hh
+
+# C/C++ Source & header files of Test Ports, external functions and
+# other modules:
+USER_SOURCES =
+USER_HEADERS =
+
+# Object files of this project that are needed for the executable test suite:
+OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS)
+
+GENERATED_OBJECTS = STOMP_Types.o STOMP_test.o
+
+USER_OBJECTS =
+
+# 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 = STOMP_Types
+
+
+
+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 -lresolv
+SOLARIS8_LIBS = -lsocket -lnsl -lxml2 -lresolv
+LINUX_LIBS = -lxml2 -lpthread -lrt
+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 -l$(TTCN3_LIB) \
+	-L$(OPENSSL_DIR)/lib -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) $(GENERATED_HEADERS) \
+	$(GENERATED_SOURCES) compile \
+	tags *.log
+
+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 XMLDIR=$(XMLDIR)
+	@echo PLATFORM=$(PLATFORM)
+
+#
+# Add your rules here if necessary...
+#
+
diff --git a/test/STOMP_test.ttcn b/test/STOMP_test.ttcn
new file mode 100644
index 0000000..474973c
--- /dev/null
+++ b/test/STOMP_test.ttcn
@@ -0,0 +1,247 @@
+module STOMP_test 
+{
+
+
+import from STOMP_Types all;
+
+
+
+
+//*******************************************************************************************
+//Templates
+
+
+template STOMPFrame t_message:=
+{
+
+  command:=MESSAGE,
+  headers:={ {header_name:="foo", header_value:="Hello"}, {header_name:="foo", header_value:="World"}},
+  payload:=omit 
+
+
+}
+
+
+template STOMPFrame t_send:=
+{
+
+  command:=SEND,
+  headers:={ {header_name:="destination", header_value:="/queue/a"}, {header_name:="receipt", header_value:="message-12345"}},
+  payload:="hello queue a" 
+
+
+}
+
+
+template STOMPFrame t_connect:=
+{
+
+  command:=CONNECT,
+  headers:={ {header_name:="accept-version", header_value:="1.2"}, {header_name:="host", header_value:="stomp.github.org"}},
+  payload:=omit
+
+
+}
+
+
+template STOMPFrame t_connected:=
+{
+
+  command:=CONNECTED,
+  headers:={ {header_name:="version", header_value:="1.2"}},
+  payload:=omit
+
+
+}
+
+
+template STOMPFrame t_error:=
+{
+
+  command:=ERROR,
+  headers:={ {header_name:="version", header_value:="1.2,2.1"},{header_name:="content-type", header_value:="text/plain"} },
+  payload:="Supported protocol versions are 1.2 2.1"
+
+
+}
+
+
+template STOMPFrame t_subscribe:=
+{
+
+  command:=SUBSCRIBE,
+  headers:={ {header_name:="id", header_value:="0"},{header_name:="destination", header_value:="/queue/foo"},{header_name:="ack", header_value:="client"} },
+  payload:=omit
+
+
+}
+
+
+template STOMPFrame t_unsubscribe:=
+{
+
+  command:=UNSUBSCRIBE,
+  headers:={ {header_name:="id", header_value:="0"} },
+  payload:=omit
+
+
+}
+
+
+template STOMPFrame t_begin:=
+{
+
+  command:=BEGIN,
+  headers:={ {header_name:="transaction", header_value:="tx1"} },
+  payload:=omit
+
+
+}
+
+template STOMPFrame t_ack:=
+{
+
+  command:=ACK,
+  headers:={{header_name:="id", header_value:="0"}, {header_name:="transaction", header_value:="tx1"} },
+  payload:=omit
+
+
+}
+
+
+template STOMPFrame t_nack:=
+{
+
+  command:=NACK,
+  headers:={{header_name:="id", header_value:="0"}, {header_name:="transaction", header_value:="tx1"} },
+  payload:=omit
+
+
+}
+
+template STOMPFrame t_commit:=
+{
+
+  command:=COMMIT,
+  headers:={ {header_name:="transaction", header_value:="tx1"} },
+  payload:=omit
+
+
+}
+
+
+template STOMPFrame t_abort:=
+{
+
+  command:=ABORT,
+  headers:={ {header_name:="transaction", header_value:="tx1"} },
+  payload:=omit
+
+
+}
+
+template STOMPFrame t_disconnect:=
+{
+
+  command:=DISCONNECT,
+  headers:={ {header_name:="receipt", header_value:="77"} },
+  payload:=omit
+
+
+}
+
+
+template STOMPFrame t_receipt:=
+{
+
+  command:=RECEIPT,
+  headers:={ {header_name:="receipt-id", header_value:="77"} },
+  payload:=omit
+
+
+}
+
+
+template STOMPFrame t_message1:=
+{
+
+  command:=MESSAGE,
+  headers:={ {header_name:="subscription", header_value:="0"}, {header_name:="message-id", header_value:="007"},{header_name:="destination", header_value:="/queue/a"}, {header_name:="content-type", header_value:="text/plain"}},
+  payload:="hello queue a"
+
+
+}
+
+
+
+template STOMPFrame t_error1:=
+{
+
+  command:=ERROR,
+  headers:={ {header_name:="receipt-id", header_value:="message@12345"},{header_name:="content-type", header_value:="text/plain"}, {header_name:="content-length", header_value:="171"},{header_name:="message", header_value:="malformed frame received"} },
+  payload:="The message:
+  -----
+  MESSAGE
+  destined:/queue/a
+  receipt:message@12345
+
+  Hello queue a!
+  -----
+  Did not contain a destination header, which is REQUIRED
+  for message propagation."
+
+
+}
+
+
+
+
+control {
+  
+  var charstring v_char
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_message))))
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_send))))
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_connect))))
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_connected))))
+
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_error))))
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_subscribe))))
+
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_unsubscribe))))
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_begin))))
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_ack))))
+  log(f_dec_stomp(f_enc_stomp(valueof(t_nack))))
+
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_commit))))
+  log(f_dec_stomp(f_enc_stomp(valueof(t_abort))))
+
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_disconnect))))
+  log(f_dec_stomp(f_enc_stomp(valueof(t_receipt))))
+  log(f_dec_stomp(f_enc_stomp(valueof(t_message1))))
+
+  log(f_dec_stomp(f_enc_stomp(valueof(t_error1))))
+
+  v_char:="MESSAGE\nsubscription:0\nmessage-id:007\r\ndestination:/queue/a\ncontent-type:text/plain\n\r\nhello queue a@@"
+
+  log(dec_STOMP(v_char))
+
+  
+
+
+ 
+
+}
+
+
+}
diff --git a/test/stomp.cfg b/test/stomp.cfg
new file mode 100644
index 0000000..8a260c1
--- /dev/null
+++ b/test/stomp.cfg
@@ -0,0 +1,17 @@
+[LOGGING]
+//LogFile := "myUDP.log"
+FileMask := LOG_ALL |  TTCN_MATCHING 
+#| TTCN_DEBUG
+ConsoleMask := TTCN_ERROR | TTCN_WARNING | TTCN_TESTCASE |
+TTCN_STATISTICS | TTCN_PORTEVENT
+LogSourceInfo := Yes
+
+[EXECUTE]
+STOMP_test.control
+
+
+
+[MAIN_CONTROLLER]
+LocalAddress := 127.0.0.1
+TCPPort := 9034
+