update 15.10.2016
diff --git a/demo/Makefile b/demo/Makefile
index 865bbc3..3f9c4ec 100644
--- a/demo/Makefile
+++ b/demo/Makefile
@@ -1,19 +1,19 @@
-# This Makefile was generated by the TITAN Designer eclipse plug-in
-# of the TTCN-3 Test executor version CRL 113 200/5 R5A
-# for  (michael@michael-desktop) on Sun Sep 18 22:14:13 CEST 2016
+# This Makefile was generated by the Makefile Generator
+# of the TTCN-3 Test Executor version CRL 113 200/6 R1A
+# for Elemer Lelik (ethlel@esekilxxen1841) on Sat Oct 15 09:22:38 2016
 
 # Copyright (c) 2000-2016 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.1 modules.
-# - make clean          Removes all generated 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: 'SocketCAN.a'.
+# - make library        Builds the library archive.
 # - make objects        Builds the object files without linking the executable.
 # WARNING! This Makefile can be used with GNU make only.
 # Other versions of make may report syntax errors in it.
@@ -21,7 +21,7 @@
 #
 # Do NOT touch this line...
 #
-.PHONY: all executable library objects check port clean dep archive
+.PHONY: all shared_objects executable library objects check port clean dep archive
 
 .SUFFIXES: .d
 
@@ -31,23 +31,23 @@
 
 # The path of your TTCN-3 Test Executor installation:
 # Uncomment this line to override the environment variable.
-# TTCN3_DIR =
+# 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 dependency generation
-CXXDEPFLAGS := -MM
+CXX = g++ 
 
 # Flags for the C++ preprocessor (and makedepend as well):
-CPPFLAGS = -D$(PLATFORM) -I. -I$(TTCN3_DIR)/include -I. -I../src
+CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include -I. -I../src
+
+# Flags for dependency generation
+CXXDEPFLAGS = -MM
 
 # Flags for the C++ compiler:
-CXXFLAGS = -Wall -O2 
+CXXFLAGS = -Wall  
 
 # Flags for the linker:
 LDFLAGS = 
@@ -62,7 +62,7 @@
 ARFLAGS = 
 
 # Flags for the TTCN-3 and ASN.1 compiler:
-COMPILER_FLAGS = -lL
+COMPILER_FLAGS = -L 
 
 # Execution mode: (either ttcn3 or ttcn3-parallel)
 TTCN3_LIB = ttcn3-parallel
@@ -83,30 +83,29 @@
 #
 
 # TTCN-3 modules of this project:
-TTCN3_MODULES = ../src/Bcm.ttcn ../src/Can.ttcn ../src/CanError.ttcn ../src/General_Types.ttcn ../src/Raw.ttcn  SocketCAN_BCM_test.ttcn ../src/SocketCAN_PortType.ttcn SocketCAN_RAW_test.ttcn ../src/SocketCAN_Types.ttcn SocketCANtest.ttcn
+TTCN3_MODULES = ../src/Bcm.ttcn ../src/Can.ttcn ../src/CanError.ttcn ../src/General_Types.ttcn ../src/Raw.ttcn SocketCAN_BCM_test.ttcn ../src/SocketCAN_PortType.ttcn SocketCAN_RAW_test.ttcn SocketCAN_Templates.ttcn ../src/SocketCAN_Types.ttcn SocketCANtest.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 = Bcm.cc Can.cc CanError.cc General_Types.cc Raw.cc SocketCAN_BCM_test.cc SocketCAN_PortType.cc SocketCAN_RAW_test.cc SocketCAN_Types.cc SocketCANtest.cc
+GENERATED_SOURCES = Bcm.cc Can.cc CanError.cc General_Types.cc Raw.cc SocketCAN_BCM_test.cc SocketCAN_PortType.cc SocketCAN_RAW_test.cc SocketCAN_Templates.cc SocketCAN_Types.cc SocketCANtest.cc $(ASN1_MODULES:.asn=.cc)
 GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
 
 # C/C++ Source & header files of Test Ports, external functions and
 # other modules:
-USER_SOURCES = ../src/SocketCAN_PT.cc 
-USER_HEADERS = ../src/SocketCAN_PT.hh
+USER_SOURCES = ../src/SocketCAN_PT.cc
+USER_HEADERS = $(USER_SOURCES:.cc=.hh)
 
 # Object files of this project that are needed for the executable test suite:
 OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS)
 
 GENERATED_OBJECTS = $(GENERATED_SOURCES:.cc=.o)
 
-USER_OBJECTS = SocketCAN_PT.o
+USER_OBJECTS = $(USER_SOURCES:.cc=.o)
 
-# Dependency files of this project that are needed for the executable test suite:
-DEPFILES = $(USER_OBJECTS:.o=.d) $(GENERATED_OBJECTS:.o=.d)
+DEPFILES = $(USER_OBJECTS:.o=.d)  $(GENERATED_OBJECTS:.o=.d)
 
 # Other files of the project (Makefile, configuration files, etc.)
 # that will be added to the archived source files:
@@ -114,6 +113,8 @@
 
 # The name of the executable test suite:
 EXECUTABLE = SocketCAN
+
+
 LIBRARY = SocketCAN.a
 
 TARGET = $(EXECUTABLE)
@@ -122,11 +123,11 @@
 # 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 
+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...
@@ -141,27 +142,21 @@
 objects: $(OBJECTS) compile;
 
 $(EXECUTABLE): $(OBJECTS)
-	$(CXX) $(LDFLAGS) -o $@ $^ \
-	-L$(TTCN3_DIR)/lib -L$(OPENSSL_DIR)/lib -L$(XMLDIR)/lib \
-	-l$(TTCN3_LIB) -lcrypto \
-	$($(PLATFORM)_LIBS) \
-	|| if [ -f $(TTCN3_DIR)/bin/titanver ]; then $(TTCN3_DIR)/bin/titanver $^; else : ; fi
+	if $(CXX) $(LDFLAGS) -o $@ $^ \
+	-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)
 
-SocketCAN_PT.o :  ../src/SocketCAN_PT.cc
+%.o: %.c $(GENERATED_HEADERS)
 	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
 
-.cc.o .c.o:
+%.o: %.cc $(GENERATED_HEADERS)
 	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
 
-SocketCAN_PT.d :  ../src/SocketCAN_PT.cc
-	@echo Creating dependency file for '$<'; set -e; \
-	$(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \
-	| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
-	[ -s $@ ] || rm -f $@
-
 .cc.d .c.d:
 	@echo Creating dependency file for '$<'; set -e; \
 	$(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \
@@ -174,28 +169,25 @@
 check: $(TTCN3_MODULES) $(ASN1_MODULES)
 	$(TTCN3_DIR)/bin/compiler -s $(COMPILER_FLAGS) $^
 
-port: $(TTCN3_MODULES) 
+port: $(TTCN3_MODULES)  
 	$(TTCN3_DIR)/bin/compiler -t $(COMPILER_FLAGS) $^
 
-compile: $(TTCN3_MODULES) $(ASN1_MODULES)
+compile: $(TTCN3_MODULES)  $(ASN1_MODULES)
 	$(TTCN3_DIR)/bin/compiler $(COMPILER_FLAGS) $^ - $?
 	touch $@
 
-browserdata.dat: $(TTCN3_MODULES) $(ASN1_MODULES)
-	$(TTCN3_DIR)/bin/compiler -B -s $(COMPILER_FLAGS) $^
-
 clean:
-	-$(RM) $(EXECUTABLE) $(OBJECTS) $(LIBRARY) $(GENERATED_HEADERS) $(DEPFILES) \
-	$(GENERATED_SOURCES) compile \
-	browserdata.dat tags *.log $(DEPFILES)
+	-$(RM) $(EXECUTABLE) $(LIBRARY) $(OBJECTS) $(GENERATED_HEADERS) \
+	$(GENERATED_SOURCES) compile $(DEPFILES) \
+	tags *.log
 
-dep: $(GENERATED_SOURCES) $(USER_SOURCES) $(DEPFILES) ;
+dep: $(GENERATED_SOURCES) $(USER_SOURCES) ; 
 
-ifeq ($(filter clean check port compile archive,$(MAKECMDGOALS)),)
+ifeq ($(findstring n,$(MAKEFLAGS)),)
+ifeq ($(filter clean check port compile archive diag,$(MAKECMDGOALS)),)
 -include $(DEPFILES)
 endif
-
-
+endif
 
 archive:
 	mkdir -p $(ARCHIVE_DIR)
diff --git a/demo/SocketCAN_Templates.ttcn b/demo/SocketCAN_Templates.ttcn
new file mode 100644
index 0000000..43cff60
--- /dev/null
+++ b/demo/SocketCAN_Templates.ttcn
@@ -0,0 +1,107 @@
+/* Copyright (c) 2010, 2016  Ericsson 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:

+* Michael Josenhans

+******************************************************************************/

+//

+//  File:               SocketCANtest.ttcn

+//  Description:        SocketCAN port type test

+//

+
+
+module SocketCAN_Templates {

+

+import from SocketCAN_Types all;

+import from Bcm all

+import from Can all

+

+template SocketCAN_Result a_result(in SocketCAN_Result_code v_result_code) := {          

+  result_code   := v_result_code,

+  err           := *,

+  err_text      := *

+}

+

+template SocketCAN_socket_result 

+a_SocketCAN_socket_result(template SocketCAN_Result p_result) := {

+  id := ?, 

+  result := p_result

+}

+

+template SocketCAN_ioctl_result 

+a_SocketCAN_ioctl_result(template SocketCAN_Result p_result) := {

+  ifr := ?,

+  result := p_result

+}

+

+template SocketCAN_connect_result

+a_SocketCAN_connect_result(template SocketCAN_Result p_result) := {

+  result := p_result

+}

+

+template SocketCAN_bind_result

+a_SocketCAN_bind_result(template SocketCAN_Result p_result) := {

+  result := p_result

+}

+

+template SocketCAN_send_data_result

+a_SocketCAN_send_data_result(template SocketCAN_Result p_result) := {

+  result := p_result

+}

+

+template SocketCAN_write_data_result

+a_SocketCAN_write_data_result(template SocketCAN_Result p_result) := {

+  result := p_result

+}

+

+template SocketCAN_receive_CAN_or_CAN_FD_frame a_SocketCAN_receive_CAN_frame(

+  template SocketCAN_socketid p_id, 

+  template CAN_id p_can_id,

+  template CAN_PDU p_can_pdu) := { 

+  // recieved CAN frame

+  id        := p_id,

+  ifr       := ?,

+  frame     := {can_frame := {can_id := p_can_id, can_pdu := p_can_pdu}}, 

+  timestamp := ?

+}

+

+

+template SocketCAN_receive_CAN_or_CAN_FD_frame a_SocketCAN_receive_CAN_FD_frame(

+  template SocketCAN_socketid p_id, 

+  template CAN_id p_can_id,

+  template CAN_PDU p_can_pdu) := { 

+  // recieved CAN or CAN FD frame

+  id        := p_id,

+  ifr       := ?,

+  frame     := {canfd_frame := {can_id := p_can_id, can_pdu := p_can_pdu}}, 

+  timestamp := ?

+}

+

+template SocketCAN_receive_CAN_or_CAN_FD_frame a_SocketCAN_receive_CAN_or_CAN_FD_frame(

+  template SocketCAN_socketid p_id, 

+  template SocketCAN_CAN_or_CAN_FD_frame p_frame) := { 

+  // recieved CAN or CAN FD frame

+  id        := p_id,

+  ifr       := ?,

+  frame     := p_frame, 

+  timestamp := ?

+}

+

+template SocketCAN_receive_BCM_message a_SocketCAN_receive_BCM_message(

+  template SocketCAN_socketid p_id, 

+  template SocketCAN_bcm_frame p_frame) := { 

+  // recieved CAN or CAN FD frame

+  id        := p_id,

+  ifr       := ?,

+  frame     := p_frame

+}

+

+template SocketCAN_setsockopt_result

+a_SocketCAN_setsockopt_result(template SocketCAN_Result p_result) := {

+  result := p_result

+}

+

+}

diff --git a/demo/SocketCANtest.ttcn b/demo/SocketCANtest.ttcn
index 27ec3a8..e27fef7 100644
--- a/demo/SocketCANtest.ttcn
+++ b/demo/SocketCANtest.ttcn
@@ -17,8 +17,8 @@
 

 import from SocketCAN_Types all;

 import from SocketCAN_PortType all;

+import from SocketCAN_Templates all;

 import from Bcm all

-import from Can all

 

 const float c_guard := 10.0

 

@@ -61,69 +61,6 @@
 const e_Phase c_firstPhase        := e_open_socket

 const e_Phase c_testcase_complete := e_testcase_complete

 

-

-template SocketCAN_Result a_result(in SocketCAN_Result_code v_result_code) := {          

-  result_code   := v_result_code,

-  err           := *,

-  err_text      := *

-}

-

-template SocketCAN_socket_result 

-a_SocketCAN_socket_result(template SocketCAN_Result p_result) := {

-  id := ?, 

-  result := p_result

-}

-

-template SocketCAN_ioctl_result 

-a_SocketCAN_ioctl_result(template SocketCAN_Result p_result) := {

-  ifr := ?,

-  result := p_result

-}

-

-template SocketCAN_connect_result

-a_SocketCAN_connect_result(template SocketCAN_Result p_result) := {

-  result := p_result

-}

-

-template SocketCAN_bind_result

-a_SocketCAN_bind_result(template SocketCAN_Result p_result) := {

-  result := p_result

-}

-

-template SocketCAN_send_data_result

-a_SocketCAN_send_data_result(template SocketCAN_Result p_result) := {

-  result := p_result

-}

-

-template SocketCAN_write_data_result

-a_SocketCAN_write_data_result(template SocketCAN_Result p_result) := {

-  result := p_result

-}

-

-template SocketCAN_receive_CAN_or_CAN_FD_frame a_SocketCAN_receive_CAN_or_CAN_FD_frame(

-  template SocketCAN_socketid p_id, 

-  template SocketCAN_CAN_or_CAN_FD_frame p_frame) := { 

-  // recieved CAN or CAN FD frame

-  id        := p_id,

-  ifr       := ?,

-  frame     := p_frame, 

-  timestamp := ?

-}

-

-template SocketCAN_receive_BCM_message a_SocketCAN_receive_BCM_message(

-  template SocketCAN_socketid p_id, 

-  template SocketCAN_bcm_frame p_frame) := { 

-  // recieved CAN or CAN FD frame

-  id        := p_id,

-  ifr       := ?,

-  frame     := p_frame

-}

-

-template SocketCAN_setsockopt_result

-a_SocketCAN_setsockopt_result(template SocketCAN_Result p_result) := {

-  result := p_result

-}

-

 type record PhaseStartReq {

   e_Phase phase,

   integer phase_int

@@ -391,7 +328,7 @@
 

     [] pt_socketCAN.receive(a_SocketCAN_receive_CAN_or_CAN_FD_frame(p_socket_id, p_frame_expected)) -> value v_result

     {log("SocketCan:Expected frame received", v_result)}

-    [] pt_socketCAN.receive(?) -> value v_result

+    [] pt_socketCAN.receive(SocketCAN_receive_CAN_or_CAN_FD_frame:?) -> value v_result

     {log("SocketCan:Unexpected frame received!", v_result)

       setverdict(fail)}

     [] t_guard.timeout {

@@ -453,7 +390,7 @@
   alt {

     [] pt_socketCAN.receive(a_SocketCAN_receive_BCM_message(p_socket_id, p_BCM_message_expected)) -> value v_result

     {log("SocketCan:Expected frame received", v_result)}

-    [] pt_socketCAN.receive(?) -> value v_result

+    [] pt_socketCAN.receive(SocketCAN_receive_BCM_message:?) -> value v_result

     {log("SocketCan:Unexpected frame received!", v_result)

       setverdict(fail)}

     [] t_guard.timeout {

diff --git a/src/Can.ttcn b/src/Can.ttcn
index 43edbd7..a666490 100644
--- a/src/Can.ttcn
+++ b/src/Can.ttcn
@@ -27,6 +27,78 @@
 const octetstring CAN_EFF_MASK := '1FFFFFFF'O // extended frame format (EFF)

 const octetstring CAN_ERR_MASK := '1FFFFFFF'O // omit EFF, RTR, ERR flags

 

+template octetstring t_CAN_EFF_FLAG:=(

+'80???'O,'81???'O,'82???'O,'83???'O,'84???'O,'85???'O,'86???'O,'87???'O,

+'88???'O,'89???'O,'8A???'O,'8B???'O,'8C???'O,'8D???'O,'8E???'O,'8F???'O,

+'90???'O,'91???'O,'92???'O,'93???'O,'94???'O,'95???'O,'96???'O,'97???'O,

+'98???'O,'99???'O,'9A???'O,'9B???'O,'9C???'O,'9D???'O,'9E???'O,'9F???'O,

+'A0???'O,'A1???'O,'A2???'O,'A3???'O,'A4???'O,'A5???'O,'A6???'O,'A7???'O,

+'A8???'O,'A9???'O,'AA???'O,'AB???'O,'AC???'O,'AD???'O,'AE???'O,'AF???'O,

+'B0???'O,'B1???'O,'B2???'O,'B3???'O,'B4???'O,'B5???'O,'B6???'O,'B7???'O,

+'B8???'O,'B9???'O,'BA???'O,'BB???'O,'BC???'O,'BD???'O,'BE???'O,'BF???'O,

+'C0???'O,'C1???'O,'C2???'O,'C3???'O,'C4???'O,'C5???'O,'C6???'O,'C7???'O,

+'C8???'O,'C9???'O,'CA???'O,'CB???'O,'CC???'O,'CD???'O,'CE???'O,'CF???'O,

+'D0???'O,'D1???'O,'D2???'O,'D3???'O,'D4???'O,'D5???'O,'D6???'O,'D7???'O,

+'D8???'O,'D9???'O,'DA???'O,'DB???'O,'DC???'O,'DD???'O,'DE???'O,'DF???'O,

+'E0???'O,'E1???'O,'E2???'O,'E3???'O,'E4???'O,'E5???'O,'E6???'O,'E7???'O,

+'E8???'O,'E9???'O,'EA???'O,'EB???'O,'EC???'O,'ED???'O,'EE???'O,'EF???'O,

+'F0???'O,'F1???'O,'F2???'O,'F3???'O,'F4???'O,'F5???'O,'F6???'O,'F7???'O,

+'F8???'O,'F9???'O,'FA???'O,'FB???'O,'FC???'O,'FD???'O,'FE???'O,'FF???'O);

+

+template octetstring t_CAN_SFF_FLAG:=(

+'00???'O,'01???'O,'02???'O,'03???'O,'04???'O,'05???'O,'06???'O,'07???'O,

+'08???'O,'09???'O,'0A???'O,'0B???'O,'0C???'O,'0D???'O,'0E???'O,'0F???'O,

+'10???'O,'11???'O,'12???'O,'13???'O,'14???'O,'15???'O,'16???'O,'17???'O,

+'18???'O,'19???'O,'1A???'O,'1B???'O,'1C???'O,'1D???'O,'1E???'O,'1F???'O,

+'20???'O,'21???'O,'22???'O,'23???'O,'24???'O,'25???'O,'26???'O,'27???'O,

+'28???'O,'29???'O,'2A???'O,'2B???'O,'2C???'O,'2D???'O,'2E???'O,'2F???'O,

+'30???'O,'31???'O,'32???'O,'33???'O,'34???'O,'35???'O,'36???'O,'37???'O,

+'38???'O,'39???'O,'3A???'O,'3B???'O,'3C???'O,'3D???'O,'3E???'O,'3F???'O,

+'40???'O,'41???'O,'42???'O,'43???'O,'44???'O,'45???'O,'46???'O,'47???'O,

+'48???'O,'49???'O,'4A???'O,'4B???'O,'4C???'O,'4D???'O,'4E???'O,'4F???'O,

+'50???'O,'51???'O,'52???'O,'53???'O,'54???'O,'55???'O,'56???'O,'57???'O,

+'58???'O,'59???'O,'5A???'O,'5B???'O,'5C???'O,'5D???'O,'5E???'O,'5F???'O,

+'60???'O,'61???'O,'62???'O,'63???'O,'64???'O,'65???'O,'66???'O,'67???'O,

+'68???'O,'69???'O,'6A???'O,'6B???'O,'6C???'O,'6D???'O,'6E???'O,'6F???'O,

+'70???'O,'71???'O,'72???'O,'73???'O,'74???'O,'75???'O,'76???'O,'77???'O,

+'78???'O,'79???'O,'7A???'O,'7B???'O,'7C???'O,'7D???'O,'7E???'O,'7F???'O);

+

+template octetstring t_CAN_RTR_FLAG:=(

+'40???'O,'41???'O,'42???'O,'43???'O,'44???'O,'45???'O,'46???'O,'47???'O,

+'48???'O,'49???'O,'4A???'O,'4B???'O,'4C???'O,'4D???'O,'4E???'O,'4F???'O,

+'50???'O,'51???'O,'52???'O,'53???'O,'54???'O,'55???'O,'56???'O,'57???'O,

+'58???'O,'59???'O,'5A???'O,'5B???'O,'5C???'O,'5D???'O,'5E???'O,'5F???'O,

+'60???'O,'61???'O,'62???'O,'63???'O,'64???'O,'65???'O,'66???'O,'67???'O,

+'68???'O,'69???'O,'6A???'O,'6B???'O,'6C???'O,'6D???'O,'6E???'O,'6F???'O,

+'70???'O,'71???'O,'72???'O,'73???'O,'74???'O,'75???'O,'76???'O,'77???'O,

+'78???'O,'79???'O,'7A???'O,'7B???'O,'7C???'O,'7D???'O,'7E???'O,'7F???'O,

+'C0???'O,'C1???'O,'C2???'O,'C3???'O,'C4???'O,'C5???'O,'C6???'O,'C7???'O,

+'C8???'O,'C9???'O,'CA???'O,'CB???'O,'CC???'O,'CD???'O,'CE???'O,'CF???'O,

+'D0???'O,'D1???'O,'D2???'O,'D3???'O,'D4???'O,'D5???'O,'D6???'O,'D7???'O,

+'D8???'O,'D9???'O,'DA???'O,'DB???'O,'DC???'O,'DD???'O,'DE???'O,'DF???'O,

+'E0???'O,'E1???'O,'E2???'O,'E3???'O,'E4???'O,'E5???'O,'E6???'O,'E7???'O,

+'E8???'O,'E9???'O,'EA???'O,'EB???'O,'EC???'O,'ED???'O,'EE???'O,'EF???'O,

+'F0???'O,'F1???'O,'F2???'O,'F3???'O,'F4???'O,'F5???'O,'F6???'O,'F7???'O,

+'F8???'O,'F9???'O,'FA???'O,'FB???'O,'FC???'O,'FD???'O,'FE???'O,'FF???'O);

+

+template octetstring t_CAN_ERR_FLAG:=(

+'20???'O,'21???'O,'22???'O,'23???'O,'24???'O,'25???'O,'26???'O,'27???'O,

+'28???'O,'29???'O,'2A???'O,'2B???'O,'2C???'O,'2D???'O,'2E???'O,'2F???'O,

+'30???'O,'31???'O,'32???'O,'33???'O,'34???'O,'35???'O,'36???'O,'37???'O,

+'38???'O,'39???'O,'3A???'O,'3B???'O,'3C???'O,'3D???'O,'3E???'O,'3F???'O,

+'60???'O,'61???'O,'62???'O,'63???'O,'64???'O,'65???'O,'66???'O,'67???'O,

+'68???'O,'69???'O,'6A???'O,'6B???'O,'6C???'O,'6D???'O,'6E???'O,'6F???'O,

+'70???'O,'71???'O,'72???'O,'73???'O,'74???'O,'75???'O,'76???'O,'77???'O,

+'78???'O,'79???'O,'7A???'O,'7B???'O,'7C???'O,'7D???'O,'7E???'O,'7F???'O,

+'A0???'O,'A1???'O,'A2???'O,'A3???'O,'A4???'O,'A5???'O,'A6???'O,'A7???'O,

+'A8???'O,'A9???'O,'AA???'O,'AB???'O,'AC???'O,'AD???'O,'AE???'O,'AF???'O,

+'B0???'O,'B1???'O,'B2???'O,'B3???'O,'B4???'O,'B5???'O,'B6???'O,'B7???'O,

+'B8???'O,'B9???'O,'BA???'O,'BB???'O,'BC???'O,'BD???'O,'BE???'O,'BF???'O,

+'E0???'O,'E1???'O,'E2???'O,'E3???'O,'E4???'O,'E5???'O,'E6???'O,'E7???'O,

+'E8???'O,'E9???'O,'EA???'O,'EB???'O,'EC???'O,'ED???'O,'EE???'O,'EF???'O,

+'F0???'O,'F1???'O,'F2???'O,'F3???'O,'F4???'O,'F5???'O,'F6???'O,'F7???'O,

+'F8???'O,'F9???'O,'FA???'O,'FB???'O,'FC???'O,'FD???'O,'FE???'O,'FF???'O);

+

 type enumerated AdresseFamily_enum

 {

 // Supported address families

diff --git a/src/SocketCAN_PT.cc b/src/SocketCAN_PT.cc
index bedb3ba..1eb600e 100644
--- a/src/SocketCAN_PT.cc
+++ b/src/SocketCAN_PT.cc
@@ -230,7 +230,8 @@
 					parameters.ifr().if__name() = ifr.ifr_name;

 					parameters.id() = a;

 

-					const INTEGER can_id = frame.can_id;

+					INTEGER can_id;

+					can_id.set_long_long_val(frame.can_id);

 #ifdef CANFD_FRAME_STRUCT_DEFINED

 					const INTEGER len = frame.len;

 #else  //CANFD_FRAME_STRUCT_DEFINED

@@ -247,7 +248,7 @@
 						parameters.ifr().if__index() = ifr.ifr_ifindex;

 						parameters.ifr().if__name() = ifr.ifr_name;

 						parameters.id() = a;

-						frameref.can__id() = int2oct(frame.can_id, 4);

+						frameref.can__id() = int2oct(can_id, 4);

 						frameref.can__pdu() = OCTETSTRING(len, frame.data);

 					} else {

 						// CAN FD frame received:

@@ -318,7 +319,9 @@
 					parameters.ifr().if__name() = ifr.ifr_name;

 

 					uint32_t nframes = bcm_msg.msg_head.nframes;

-					parameters.frame().opcode() = int2oct(bcm_msg.msg_head.opcode, 4);

+					INTEGER opcode;

+					opcode.set_long_long_val(bcm_msg.msg_head.opcode);

+					parameters.frame().opcode() = int2oct(opcode, 4);

 					parameters.frame().flags() = BITSTRING(

 							int2bit(INTEGER(msg_head_flags),

 									BCM_FRAME_FLAGS_SIZE));

@@ -331,7 +334,9 @@
 							bcm_msg.msg_head.ival2.tv_sec;

 					parameters.frame().ival2().tv__usec() =

 							bcm_msg.msg_head.ival2.tv_usec;

-					parameters.frame().can__id() = int2oct(bcm_msg.msg_head.can_id, 4);

+					INTEGER bcm_head_can_id;

+					bcm_head_can_id.set_long_long_val(bcm_msg.msg_head.can_id);

+					parameters.frame().can__id() = int2oct(bcm_head_can_id, 4);

 #ifdef BCM_CANFD_SUPPORT

 					long flags = bcm_msg.msg_head.flags;

 					if ((flags & CAN_FD_FRAME ) == CAN_FD_FRAME ) {

@@ -344,8 +349,9 @@
 							if (len > CANFD_MAX_DLEN) {

 								TTCN_error("Writing data: CAN FD pdu size too large\n");

 							};

-							parameters.frame().frames().canfd__frame()[i].can__id() =

-							int2oct(bcm_msg.frame[i].can_id, 4);

+							INTEGER can_id;

+							can_id.set_long_long_val(bcm_msg.frame[i].can_id);

+							parameters.frame().frames().canfd__frame()[i].can__id() = int2oct(can_id, 4);

 							//Here the bitstring shall be stored into a

 							parameters.frame().frames().canfd__frame()[i].can__flags() =

 							BITSTRING(32,

@@ -373,8 +379,9 @@
 								TTCN_error("Writing data: CAN pdu size too large\n");

 								len = CAN_MAX_DLEN;

 							};

-							parameters.frame().frames().can__frame()[i].can__id() =

-									int2oct(bcm_msg.frame[i].can_id, 4);

+							INTEGER can_id;

+							can_id.set_long_long_val(bcm_msg.frame[i].can_id);

+							parameters.frame().frames().can__frame()[i].can__id() =	int2oct(can_id, 4);

 							parameters.frame().frames().can__frame()[i].can__pdu() =

 									OCTETSTRING(len,

 											(const unsigned char*) &(bcm_msg.frame[i].data));