diff --git a/TCCUsefulFunctions_CNL113472_Common.tpd b/TCCUsefulFunctions_CNL113472_Common.tpd
index 65881235be656857be40d092b6e9c3531176c229..f13aed554575a964de1a64ed65a0f71f182c1e16 100644
--- a/TCCUsefulFunctions_CNL113472_Common.tpd
+++ b/TCCUsefulFunctions_CNL113472_Common.tpd
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2016 Ericsson
+ Copyright (c) 2017 Ericsson
 
-  The copyright to the computer  program(s) herein  is the property of Ericsson.
-  The program(s) may be used and/or copied only with the written permission
-  of Ericsson or in accordance with  the terms and conditions  stipulated in the
-  agreement/contract under which the program(s) has been supplied.
+  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
 
 
    File:               TCCUsefulFunctions_CNL113472_Common.tpd
    Description:        tpd project file
-   Rev:                R25A
+   Rev:                R30A
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_IPsec.tpd b/TCCUsefulFunctions_CNL113472_IPsec.tpd
index ae7601c1603a865d65b9819022207ce99f6aac72..de94e2ef500252229826200134fb1e3aacc02db1 100644
--- a/TCCUsefulFunctions_CNL113472_IPsec.tpd
+++ b/TCCUsefulFunctions_CNL113472_IPsec.tpd
@@ -1,16 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2016 Ericsson
+ Copyright (c) 2017 Ericsson
+
+  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
 
-  The copyright to the computer  program(s) herein  is the property of Ericsson.
-  The program(s) may be used and/or copied only with the written permission
-  of Ericsson or in accordance with  the terms and conditions  stipulated in the
-  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_IPsec.tpd
    Description:        tpd project file
-   Rev:                R25A
+   Rev:                R30A
    Prodnr:             CNL 113 472
 
  -->
@@ -20,6 +21,11 @@
     <FileResource projectRelativePath="TCCIPsec.cc" relativeURI="src/TCCIPsec.cc"/>
     <FileResource projectRelativePath="TCCIPsec_Definitions.ttcn" relativeURI="src/TCCIPsec_Definitions.ttcn"/>
     <FileResource projectRelativePath="TCCIPsec_Functions.ttcn" relativeURI="src/TCCIPsec_Functions.ttcn"/>
+    <FileResource projectRelativePath="TCCIPsec_XFRM.cc" relativeURI="src/TCCIPsec_XFRM.cc"/>
+    <FileResource projectRelativePath="TCCIPsec_XFRM.hh" relativeURI="src/TCCIPsec_XFRM.hh"/>
+    <FileResource projectRelativePath="TCCIPsec_XFRM_Definitions.ttcn" relativeURI="src/TCCIPsec_XFRM_Definitions.ttcn"/>
+    <FileResource projectRelativePath="TCCIPsec_XFRM_SA.cc" relativeURI="src/TCCIPsec_XFRM_SA.cc"/>
+    <FileResource projectRelativePath="TCCIPsec_XFRM_SP.cc" relativeURI="src/TCCIPsec_XFRM_SP.cc"/>
   </Files>
   <ActiveConfiguration>KAME_IPSEC</ActiveConfiguration>
   <Configurations>
diff --git a/TCCUsefulFunctions_CNL113472_Interface.tpd b/TCCUsefulFunctions_CNL113472_Interface.tpd
index a669755651b4e253d5a3cabf7ca4e2b85f5f7d2b..d852adfa1a0c94aa2e05405e396b50a49411fa0b 100644
--- a/TCCUsefulFunctions_CNL113472_Interface.tpd
+++ b/TCCUsefulFunctions_CNL113472_Interface.tpd
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2016 Ericsson
+ Copyright (c) 2017 Ericsson
 
-  The copyright to the computer  program(s) herein  is the property of Ericsson.
-  The program(s) may be used and/or copied only with the written permission
-  of Ericsson or in accordance with  the terms and conditions  stipulated in the
-  agreement/contract under which the program(s) has been supplied.
+  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
 
 
    File:               TCCUsefulFunctions_CNL113472_Interface.tpd
    Description:        tpd project file
-   Rev:                R25A
+   Rev:                R30A
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_Maths.tpd b/TCCUsefulFunctions_CNL113472_Maths.tpd
index c9fa16e91deacdb958cfad741fd41a0a8dd72dde..a89ba9ad32178195249cbf7ae9e8f086d0db2a6f 100644
--- a/TCCUsefulFunctions_CNL113472_Maths.tpd
+++ b/TCCUsefulFunctions_CNL113472_Maths.tpd
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2016 Ericsson
+ Copyright (c) 2017 Ericsson
 
-  The copyright to the computer  program(s) herein  is the property of Ericsson.
-  The program(s) may be used and/or copied only with the written permission
-  of Ericsson or in accordance with  the terms and conditions  stipulated in the
-  agreement/contract under which the program(s) has been supplied.
+  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
 
 
    File:               TCCUsefulFunctions_CNL113472_Maths.tpd
    Description:        tpd project file
-   Rev:                R25A
+   Rev:                R30A
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_OpenSecurity.tpd b/TCCUsefulFunctions_CNL113472_OpenSecurity.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..d3143d54f657db98362472304c70283154e20e96
--- /dev/null
+++ b/TCCUsefulFunctions_CNL113472_OpenSecurity.tpd
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2017 Ericsson
+
+  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
+
+
+
+   File:               TCCUsefulFunctions_CNL113472_OpenSecurity.tpd
+   Description:        tpd project file
+   Rev:                R30A
+   Prodnr:             CNL 113 472
+
+ -->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>TCCUsefulFunctions_CNL113472_OpenSecurity</ProjectName>
+  <Files>
+    <FileResource projectRelativePath="TCCOpenSecurity.cc" relativeURI="src/TCCOpenSecurity.cc"/>
+    <FileResource projectRelativePath="TCCOpenSecurity_Functions.ttcn" relativeURI="src/TCCOpenSecurity_Functions.ttcn"/>
+  </Files>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+	  <generateInternalMakefile>true</generateInternalMakefile>
+          <GNUMake>true</GNUMake>
+	  <incrementalDependencyRefresh>true</incrementalDependencyRefresh>
+          <targetExecutable>bin/TCCUsefulFunctions_CNL113472_Security</targetExecutable>
+          <buildLevel>Level 3 - Creating object files with dependency update</buildLevel>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin</workingDirectory>
+        </LocalBuildSettings>
+        <NamingCoventions>
+          <enableProjectSpecificSettings>true</enableProjectSpecificSettings>
+          <externalFunction>.*</externalFunction>
+          <formalParameter>.*</formalParameter>
+        </NamingCoventions>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd b/TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd
index 7ff0eca4a791650664a1b196922d4ce3061ed287..73208fcfe714df559d5b6dacfc849f981103f7ce 100644
--- a/TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd
+++ b/TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2016 Ericsson
+ Copyright (c) 2017 Ericsson
 
-  The copyright to the computer  program(s) herein  is the property of Ericsson.
-  The program(s) may be used and/or copied only with the written permission
-  of Ericsson or in accordance with  the terms and conditions  stipulated in the
-  agreement/contract under which the program(s) has been supplied.
+  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
 
 
    File:               TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd
    Description:        tpd project file
-   Rev:                R25A
+   Rev:                R30A
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_Regexp.tpd b/TCCUsefulFunctions_CNL113472_Regexp.tpd
index 3e996cf3a68c42f8581b029ec85aba6324de6c8e..13b3d9359f9b69df205820e425a09be57fec021f 100644
--- a/TCCUsefulFunctions_CNL113472_Regexp.tpd
+++ b/TCCUsefulFunctions_CNL113472_Regexp.tpd
@@ -1,16 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2016 Ericsson
+ Copyright (c) 2017 Ericsson
+
+  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
 
-  The copyright to the computer  program(s) herein  is the property of Ericsson.
-  The program(s) may be used and/or copied only with the written permission
-  of Ericsson or in accordance with  the terms and conditions  stipulated in the
-  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_Regexp.tpd
    Description:        tpd project file
-   Rev:                R25A
+   Rev:                R30A
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_TitanSim.tpd b/TCCUsefulFunctions_CNL113472_TitanSim.tpd
index 2a775d00121f12c963ad1fdb85c6f5e03f74848a..74539c0d232a1d553544a0a698379557f3f9b694 100644
--- a/TCCUsefulFunctions_CNL113472_TitanSim.tpd
+++ b/TCCUsefulFunctions_CNL113472_TitanSim.tpd
@@ -1,16 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2016 Ericsson
+ Copyright (c) 2017 Ericsson
+
+  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
 
-  The copyright to the computer  program(s) herein  is the property of Ericsson.
-  The program(s) may be used and/or copied only with the written permission
-  of Ericsson or in accordance with  the terms and conditions  stipulated in the
-  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_TitanSim.tpd
    Description:        tpd project file
-   Rev:                R25A
+   Rev:                R30A
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_XPath.tpd b/TCCUsefulFunctions_CNL113472_XPath.tpd
index 4043c34236079c898ee6da5185e3f783dd51d1ee..2bf643fb879b78e36c3958f43d565d43dbed3b23 100644
--- a/TCCUsefulFunctions_CNL113472_XPath.tpd
+++ b/TCCUsefulFunctions_CNL113472_XPath.tpd
@@ -1,16 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2016 Ericsson
+ Copyright (c) 2017 Ericsson
+
+  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
 
-  The copyright to the computer  program(s) herein  is the property of Ericsson.
-  The program(s) may be used and/or copied only with the written permission
-  of Ericsson or in accordance with  the terms and conditions  stipulated in the
-  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_XPath.tpd
    Description:        tpd project file
-   Rev:                R25A
+   Rev:                R30A
    Prodnr:             CNL 113 472
 
  -->
diff --git a/demo/TCCAssertion_Example.ttcn b/demo/TCCAssertion_Example.ttcn
index 436e24a08907d3b3830e1e8da24f3fb9b2d4e254..a600570aa40b0933f75c03ff0b875165e71821f9 100644
--- a/demo/TCCAssertion_Example.ttcn
+++ b/demo/TCCAssertion_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCAssertion_Example.ttcn
 //  Description:        TCC Useful Functions: Assertion Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2007-11-14
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCConversion_Example.ttcn b/demo/TCCConversion_Example.ttcn
index 34cf11759d33404da1ec741dc90d1b1dc8c9acb3..4dca33a6b3c242fad6f7836ac620500c214b0812 100644
--- a/demo/TCCConversion_Example.ttcn
+++ b/demo/TCCConversion_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCConversion_Example.ttcn
 //  Description:        TCC Useful Functions: Conversion Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2013-09-24
 //  Contact:            http://ttcn.ericsson.se
@@ -248,6 +248,6 @@ control
 
 }//end of module
 with {
-extension "version R22B"
+extension "version R30A"
 }
 
diff --git a/demo/TCCDateTime_Example.ttcn b/demo/TCCDateTime_Example.ttcn
index 14f7110108aaaf39e56d968e4b6bd9907a50fc75..37880f59f35463320ba19c099b6dabcdc81e429b 100644
--- a/demo/TCCDateTime_Example.ttcn
+++ b/demo/TCCDateTime_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCDateTime_Example.ttcn
 //  Description:        TCC Useful testcases: DateTime testcases.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2011-05-30
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCEncoding_Example.ttcn b/demo/TCCEncoding_Example.ttcn
index 838b416919867abf85ff4134e4d87b8f37d05370..9b192c747b4c8a0664f0f0fd8f50f28f9e9e31a1 100644
--- a/demo/TCCEncoding_Example.ttcn
+++ b/demo/TCCEncoding_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCEncoding_Example.ttcn
 //  Description:        TCC Useful Functions: Message Encoding Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2013-02-05
 //  Contact:            http://ttcn.ericsson.se
@@ -151,5 +151,5 @@ control {
   execute(tc_005_artf265694());   
 }
 
-} with {extension "version R22B"}
+} with {extension "version R30A"}
 
diff --git a/demo/TCCEnv_Example.ttcn b/demo/TCCEnv_Example.ttcn
index 9df673a1df4fc69dc1ce13ba6da3a34754f5ef8a..1ca5b5867c90319897043d3a0375d7f1faa7917b 100644
--- a/demo/TCCEnv_Example.ttcn
+++ b/demo/TCCEnv_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCEnv_Example.ttcn
 //  Description:        TCC Useful Functions: Environment Handling Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2008-12-10
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCFileIO_Example.ttcn b/demo/TCCFileIO_Example.ttcn
index 0346d13d7a2d7f124997934e8e9ae9acea417321..2fb9dac05ea2bec305aef55d9b1affc91b3d7221 100644
--- a/demo/TCCFileIO_Example.ttcn
+++ b/demo/TCCFileIO_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCFileIO_Example.ttcn
 //  Description:        TCC Useful Functions: File IO Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2008-12-10
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCFileSystem_Example.ttcn b/demo/TCCFileSystem_Example.ttcn
index de4c5c25ec39711c8d4838bb203743f83a9fcaba..2013c8e011a98e4c08d9a98a458bf52edd942b5e 100644
--- a/demo/TCCFileSystem_Example.ttcn
+++ b/demo/TCCFileSystem_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCFileSystem_Example.ttcn
 //  Description:        TCC Useful testcases: FileSystem testcases.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2011-07-14
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCIPsec_Example.ttcn b/demo/TCCIPsec_Example.ttcn
index 469870d2686ee94e7dc267ad2927560b98a77310..121fdd092e1a76a78a6e45c1f4877ca7cb093380 100644
--- a/demo/TCCIPsec_Example.ttcn
+++ b/demo/TCCIPsec_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCAssertion_Example.ttcn
 //  Description:        TCC Useful Functions: Assertion Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2013-01-09
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCInterface_Example.ttcn b/demo/TCCInterface_Example.ttcn
index 6626d0336199b50bdc8e2493bf23ac7fac6d9be3..7f8f1e70cc12d5dad3f717b8022c252b4619ce6c 100644
--- a/demo/TCCInterface_Example.ttcn
+++ b/demo/TCCInterface_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCInterface_Example.ttcn
 //  Description:        TCC Useful Functions: Interface Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2008-12-10
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCMaths_Example.ttcn b/demo/TCCMaths_Example.ttcn
index 4221e747a69fa2a564472b35ddd711aab6b436d1..571d13f68baebca0e2a15ecc16601b5da6e7f3f8 100644
--- a/demo/TCCMaths_Example.ttcn
+++ b/demo/TCCMaths_Example.ttcn
@@ -1,22 +1,22 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCMaths_Example.ttcn
 //  Description:        TCC Useful testcases: Maths testcases.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2007-12-09
 //  Contact:            http://ttcn.ericsson.se
 ///////////////////////////////////////////////
 
-module TCCMaths_Example 
+module TCCMaths_Example
 {
 
 import from TCCMaths_Functions all;
@@ -24,31 +24,40 @@ import from TCCMaths_GenericTypes all;
 
 modulepar float LIMIT := 0.01;
 
-type component Maths_CT { 
+type component Maths_CT {
   // math
   var float tmpFloat;
   var integer tmpInt;
   var float sum;
+  var float resFZero := 0.0;
 
   // integer
   var IntegerList ilist1 := { 1, 2, 3, 4, 5};
   var IntegerList ilist2 := { 6, 7, 8, 9, 10};
+  var IntegerList ilist_one_value := {42};
+  var IntegerList ilist_empty := {};
+  var IntegerList ilist_unbound;
   var IntegerList ires;
 
   var IntegerList maxIL1 := {5, 4};
   var IntegerList minIL1 := {1, 0};
+  var IntegerList errIL := {0, -1};
   var float avgIL1 := 3.0;
   var IntegerList updIL1 := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
   var float stdIL1 := 1.581139;
-  var float stdILL1 := 1.581139;  
+  var float stdILL1 := 1.581139;
 
   // float
   var FloatList flist1 := { 1.0, 2.0, 3.0, 4.0, 5.0};
   var FloatList flist2 := { 6.0, 7.0, 8.0, 9.0, 10.0};
+  var FloatList flist_one_value := {42.0};
+  var FloatList flist_empty := {};
+  var FloatList flist_unbound;
   var FloatList fres;
 
   var FloatList maxFL1 := {5.0, 4.0};
   var FloatList minFL1 := {1.0, 0.0};
+  var FloatList errFL := {0.0, -1.0};
   var float avgFL1 := 3.0;
   var FloatList updFL1 := { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
   var float stdFL1 := 1.58;
@@ -88,6 +97,20 @@ testcase f_test_maxIL() runs on Maths_CT
 
   if (ires == maxIL1) { setverdict(pass); }
   else { setverdict(fail); }
+
+  log("Max of empty integer list");
+  ires := f_maxIL(ilist_empty);
+  log("MaxIL (maxVal, maxIdx): ", ires);
+
+  if (ires == errIL) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Max of unbound integer list");
+  ires := f_maxIL(ilist_unbound);
+  log("MaxIL (maxVal, maxIdx): ", ires);
+
+  if (ires == errIL) { setverdict(pass); }
+  else { setverdict(fail); }
 }
 
 // test f_minIL testcase
@@ -107,6 +130,20 @@ testcase f_test_minIL() runs on Maths_CT
 
   if (ires == minIL1) { setverdict(pass); }
   else { setverdict(fail); }
+
+  log("Min of empty integer list");
+  ires := f_minIL(ilist_empty);
+  log("MinIL (minVal, minIdx): ", ires);
+
+  if (ires == errIL) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Min of unbound integer list");
+  ires := f_minIL(ilist_unbound);
+  log("MinIL (minVal, minIdx): ", ires);
+
+  if (ires == errIL) { setverdict(pass); }
+  else { setverdict(fail); }
 }
 
 // test f_averageIL testcase
@@ -122,10 +159,28 @@ testcase f_test_averageIL() runs on Maths_CT
   log(" ----------- f_averageIL ----------- ");
   log("Original integer list: ", ilist1);
   tmpFloat := f_averageIL(ilist1);
-  log("AverageIL (averageVal, averageIdx): ", tmpFloat);
+  log("AverageIL: ", tmpFloat);
 
   if (tmpFloat == avgIL1) { setverdict(pass); }
   else { setverdict(fail); }
+
+  log("Average for one value list");
+  tmpFloat := f_averageIL(ilist_one_value);
+  log("AverageIL: ", tmpFloat);
+  if (tmpFloat == int2float(ilist_one_value[0])) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Average for empty list");
+  tmpFloat := f_averageIL(ilist_empty);
+  log("AverageIL: ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Average for unbound list");
+  tmpFloat := f_averageIL(ilist_unbound);
+  log("AverageIL: ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
 }
 
 // test f_averageIL testcase
@@ -164,12 +219,30 @@ testcase f_test_stdIL() runs on Maths_CT
   tmpFloat := f_stdIL(ilist1);
   log("Normalized, standard derivation (IL): ", tmpFloat);
 
-  if ((tmpFloat - stdIL1) * (tmpFloat - stdIL1) < LIMIT) { 
-    setverdict(pass); 
+  if ((tmpFloat - stdIL1) * (tmpFloat - stdIL1) < LIMIT) {
+    setverdict(pass);
   }
-  else { 
-    setverdict(fail); 
+  else {
+    setverdict(fail);
   }
+
+  log("Normalized, standard derivation for one value list");
+  tmpFloat := f_stdIL(ilist_one_value);
+  log("Normalized, standard derivation (IL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Normalized, standard derivation for empty list");
+  tmpFloat := f_stdIL(ilist_empty);
+  log("Normalized, standard derivation (IL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Normalized, standard derivation for unbound list");
+  tmpFloat := f_stdIL(ilist_unbound);
+  log("Normalized, standard derivation (IL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
 }
 
 // test f_averageILL testcase
@@ -187,12 +260,30 @@ testcase f_test_stdILL() runs on Maths_CT
   tmpFloat := f_stdILL(ilist1, f_averageIL(ilist1));
   log("Normalized, standard derivation (ILL): ", tmpFloat);
 
-  if ((tmpFloat - stdILL1) * (tmpFloat - stdILL1) < LIMIT) { 
-    setverdict(pass); 
+  if ((tmpFloat - stdILL1) * (tmpFloat - stdILL1) < LIMIT) {
+    setverdict(pass);
   }
-  else { 
-    setverdict(fail); 
+  else {
+    setverdict(fail);
   }
+
+  log("Normalized, standard derivation for one value list");
+  tmpFloat := f_stdILL(ilist_one_value, f_averageIL(ilist1));
+  log("Normalized, standard derivation (IL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Normalized, standard derivation for empty list");
+  tmpFloat := f_stdILL(ilist_empty, f_averageIL(ilist1));
+  log("Normalized, standard derivation (IL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Normalized, standard derivation for unbound list");
+  tmpFloat := f_stdILL(ilist_unbound, f_averageIL(ilist1));
+  log("Normalized, standard derivation (IL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
 }
 
 // test f_maxIL testcase
@@ -212,6 +303,20 @@ testcase f_test_maxFL() runs on Maths_CT
 
   if (fres == maxFL1) { setverdict(pass); }
   else { setverdict(fail); }
+
+  log("Max of empty float list");
+  fres := f_maxFL(flist_empty);
+  log("MaxFL (maxVal, maxIdx): ", fres);
+
+  if (fres == errFL) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Max of unbound float list");
+  fres := f_maxFL(flist_unbound);
+  log("MaxFL (maxVal, maxIdx): ", fres);
+
+  if (fres == errFL) { setverdict(pass); }
+  else { setverdict(fail); }
 }
 
 // test f_minIL testcase
@@ -227,10 +332,24 @@ testcase f_test_minFL() runs on Maths_CT
   log(" ----------- f_minFL ----------- ");
   log("Original float list: ", flist1);
   fres := f_minFL(flist1);
-  log("MinIL (minVal, minIdx): ", fres);
+  log("MinFL (minVal, minIdx): ", fres);
 
   if (fres == minFL1) { setverdict(pass); }
   else { setverdict(fail); }
+
+  log("Min of empty float list");
+  fres := f_minFL(flist_empty);
+  log("MinFL (minVal, minIdx): ", fres);
+
+  if (fres == errFL) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Min of unbound float list");
+  fres := f_minFL(flist_unbound);
+  log("MinFL (minVal, minIdx): ", fres);
+
+  if (fres == errFL) { setverdict(pass); }
+  else { setverdict(fail); }
 }
 
 // test f_averageIL testcase
@@ -245,11 +364,29 @@ testcase f_test_averageFL() runs on Maths_CT
 
   log(" ----------- f_averageFL ----------- ");
   log("Original float list: ", flist1);
-  tmpFloat := f_averageFL(flist1);  
-  log("AverageIL (averageVal, averageIdx): ", tmpFloat);
+  tmpFloat := f_averageFL(flist1);
+  log("AverageFL: ", tmpFloat);
 
   if (tmpFloat == avgFL1) { setverdict(pass); }
   else { setverdict(fail); }
+
+  log("Average for one value list");
+  tmpFloat := f_averageFL(flist_one_value);
+  log("AverageFL: ", tmpFloat);
+  if (tmpFloat == flist_one_value[0]) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Average for empty list");
+  tmpFloat := f_averageFL(flist_empty);
+  log("AverageFL: ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Average for unbound list");
+  tmpFloat := f_averageFL(flist_unbound);
+  log("AverageFL: ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
 }
 
 // test f_averageIL testcase
@@ -286,14 +423,32 @@ testcase f_test_stdFL() runs on Maths_CT
   log(" ----------- f_stdFL ----------- ");
   log("Original float list: ", flist1);
   tmpFloat := f_stdFL(flist1);
-  log("Normalized, standard derivation (IL): ", tmpFloat);
+  log("Normalized, standard derivation (FL): ", tmpFloat);
 
-  if ((tmpFloat - stdFL1) * (tmpFloat - stdFL1) < LIMIT) { 
-    setverdict(pass); 
+  if ((tmpFloat - stdFL1) * (tmpFloat - stdFL1) < LIMIT) {
+    setverdict(pass);
   }
-  else { 
-    setverdict(fail); 
+  else {
+    setverdict(fail);
   }
+
+  log("Normalized, standard derivation for one value list");
+  tmpFloat := f_stdFL(flist_one_value);
+  log("Normalized, standard derivation (FL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Normalized, standard derivation for empty list");
+  tmpFloat := f_stdFL(flist_empty);
+  log("Normalized, standard derivation (FL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Normalized, standard derivation for unbound list");
+  tmpFloat := f_stdFL(flist_unbound);
+  log("Normalized, standard derivation (FL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
 }
 
 // test f_averageFLL testcase
@@ -311,11 +466,29 @@ testcase f_test_stdFLL() runs on Maths_CT
   tmpFloat := f_stdFLL(flist1, f_averageFL(flist1));
   log("Normalized, standard derivation (FLL): ", tmpFloat);
 
-  if ((tmpFloat - stdFLL1) * (tmpFloat - stdFLL1) < LIMIT) { 
-    setverdict(pass); 
+  if ((tmpFloat - stdFLL1) * (tmpFloat - stdFLL1) < LIMIT) {
+    setverdict(pass);
   }
-  else { 
-    setverdict(fail); 
+  else {
+    setverdict(fail);
+
+  log("Normalized, standard derivation for one value list");
+  tmpFloat := f_stdFLL(flist_one_value, f_averageFL(flist1));
+  log("Normalized, standard derivation (FL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Normalized, standard derivation for empty list");
+  tmpFloat := f_stdFLL(flist_empty, f_averageFL(flist1));
+  log("Normalized, standard derivation (FL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
+
+  log("Normalized, standard derivation for unbound list");
+  tmpFloat := f_stdFLL(flist_unbound, f_averageFL(flist1));
+  log("Normalized, standard derivation (FL): ", tmpFloat);
+  if (tmpFloat == resFZero) { setverdict(pass); }
+  else { setverdict(fail); }
   }
 }
 
@@ -323,10 +496,10 @@ testcase f_test_stdFLL() runs on Maths_CT
 testcase f_test_sinVL() runs on Maths_CT
 {
   log(" ----------- f_sinVL ----------- ");
-  log("SINUS (Frequency: ", freq, 
-    ", altitude: ", alti, 
-    ", startval: ", startval, 
-    ", step: ", step, 
+  log("SINUS (Frequency: ", freq,
+    ", altitude: ", alti,
+    ", startval: ", startval,
+    ", step: ", step,
     ", return length: ", len, "):");
 
   fres := f_sinVL(freq, alti, startval, len, step);
@@ -347,10 +520,10 @@ testcase f_test_sinVL() runs on Maths_CT
 testcase f_test_cosVL() runs on Maths_CT
 {
   log(" ----------- f_cosVL ----------- ");
-  log("COSINUS (Frequency: ", freq, 
-    ", altitude: ", alti, 
-    ", startval: ", startval, 
-    ", step: ", step, 
+  log("COSINUS (Frequency: ", freq,
+    ", altitude: ", alti,
+    ", startval: ", startval,
+    ", step: ", step,
     ", return length: ", len, "):");
 
   fres := f_cosVL(freq, alti, startval, len, step);
@@ -364,7 +537,7 @@ testcase f_test_cosVL() runs on Maths_CT
     sum := sum + tmpFloat * tmpFloat;
   }
   if (sum < LIMIT) { setverdict(pass); }
-  else { setverdict(fail); }  
+  else { setverdict(fail); }
 }
 
 // test function pi
@@ -380,7 +553,7 @@ testcase f_test_pi() runs on Maths_CT
 testcase f_test_sin() runs on Maths_CT
 {
   log(" ----------- f_sin ----------- ");
-  
+
   tmpFloat := f_sin(3.1415926535 / 2.0);
   log("Sine of PI/2: ", tmpFloat);
 
@@ -392,7 +565,7 @@ testcase f_test_sin() runs on Maths_CT
 testcase f_test_cos() runs on Maths_CT
 {
   log(" ----------- f_cos ----------- ");
-  
+
   tmpFloat := f_cos(3.1415926535 / 2.0);
   log("Cosine of PI/2: ", tmpFloat);
 
@@ -403,13 +576,13 @@ testcase f_test_cos() runs on Maths_CT
 testcase f_test_asin() runs on Maths_CT
 {
   log(" ----------- f_asin ----------- ");
-  
+
   tmpFloat := f_asin(1.0);
   log("Arc sine of 1.0: ", tmpFloat);
 
   tmpFloat := tmpFloat - 3.1415926535 / 2.0;
-  if (tmpFloat * tmpFloat < LIMIT )  { 
-    setverdict(pass); 
+  if (tmpFloat * tmpFloat < LIMIT )  {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -417,13 +590,13 @@ testcase f_test_asin() runs on Maths_CT
 testcase f_test_acos() runs on Maths_CT
 {
   log(" ----------- f_acos ----------- ");
-  
+
   tmpFloat := f_acos(0.0);
   log("Arc cosine of 0.0: ", tmpFloat);
 
   tmpFloat := tmpFloat - 3.1415926535 / 2.0;
-  if (tmpFloat * tmpFloat < LIMIT)  { 
-    setverdict(pass); 
+  if (tmpFloat * tmpFloat < LIMIT)  {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -431,13 +604,13 @@ testcase f_test_acos() runs on Maths_CT
 testcase f_test_powFF() runs on Maths_CT
 {
   log(" ----------- f_powFF ----------- ");
-  
+
   tmpFloat := f_powFF(2.0, 3.0);
   log("Raise 2.0 to power 3.0: ", tmpFloat);
 
   tmpFloat := tmpFloat - 8.0;
-  if ( tmpFloat * tmpFloat < LIMIT) { 
-    setverdict(pass); 
+  if ( tmpFloat * tmpFloat < LIMIT) {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -445,12 +618,12 @@ testcase f_test_powFF() runs on Maths_CT
 testcase f_test_powII() runs on Maths_CT
 {
   log(" ----------- f_powII ----------- ");
-  
+
   tmpInt := f_powII(2, 3);
   log("Raise 2 to power 3: ", tmpInt);
 
-  if ( tmpInt == 8) { 
-    setverdict(pass); 
+  if ( tmpInt == 8) {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -458,13 +631,13 @@ testcase f_test_powII() runs on Maths_CT
 testcase f_test_powIF() runs on Maths_CT
 {
   log(" ----------- f_powIF ----------- ");
-  
+
   tmpFloat := f_powIF(2, 3.0);
   log("Raise 2 to power 3.0: ", tmpFloat);
 
   tmpFloat := tmpFloat - 8.0;
-  if ( tmpFloat * tmpFloat < LIMIT) { 
-    setverdict(pass); 
+  if ( tmpFloat * tmpFloat < LIMIT) {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -472,54 +645,54 @@ testcase f_test_powIF() runs on Maths_CT
 testcase f_test_powFI() runs on Maths_CT
 {
   log(" ----------- f_powFI ----------- ");
-  
+
   tmpFloat := f_powFI(2.0, 3);
   log("Raise 2.0 to power 3: ", tmpFloat);
 
   tmpFloat := tmpFloat - 8.0;
-  if ( tmpFloat * tmpFloat < LIMIT) { 
-    setverdict(pass); 
+  if ( tmpFloat * tmpFloat < LIMIT) {
+    setverdict(pass);
   }
-  else { setverdict(fail); }  
+  else { setverdict(fail); }
 }
 
 testcase f_test_powFF_cubicRootOfTwo() runs on Maths_CT
 {
   log(" ----------- f_powFF (Cubic root) ----------- ");
-  
+
   tmpFloat := f_powFF(2.0, 1.0/3.0);
   log("Raise 2.0 to power 0.3333: ", tmpFloat);
 
   tmpFloat := tmpFloat - 1.2599215;
-  if ( tmpFloat * tmpFloat < LIMIT) { 
-    setverdict(pass); 
+  if ( tmpFloat * tmpFloat < LIMIT) {
+    setverdict(pass);
   }
-  else { setverdict(fail); }  
+  else { setverdict(fail); }
 }
 
 testcase f_test_sqrF() runs on Maths_CT
 {
   log(" ----------- f_sqrF ----------- ");
-  
+
   tmpFloat := f_sqrF(2.0);
   log("Square of 2.0: ", tmpFloat);
 
   tmpFloat := tmpFloat - 4.0;
-  if ( tmpFloat * tmpFloat < LIMIT) { 
-    setverdict(pass); 
+  if ( tmpFloat * tmpFloat < LIMIT) {
+    setverdict(pass);
   }
-  else { setverdict(fail); }  
+  else { setverdict(fail); }
 }
 
 testcase f_test_sqrI() runs on Maths_CT
 {
   log(" ----------- f_sqrI ----------- ");
-  
+
   tmpInt := f_sqrI(2);
   log("Square of 2: ", tmpInt);
 
-  if ( tmpInt == 4) { 
-    setverdict(pass); 
+  if ( tmpInt == 4) {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -527,13 +700,13 @@ testcase f_test_sqrI() runs on Maths_CT
 testcase f_test_sqrtF() runs on Maths_CT
 {
   log(" ----------- f_sqrtF ----------- ");
-  
+
   tmpFloat := f_sqrtF(2.0);
   log("Square root of 2.0: ", tmpFloat);
 
   tmpFloat := tmpFloat - 1.4142145;
-  if ( tmpFloat * tmpFloat < LIMIT) { 
-    setverdict(pass); 
+  if ( tmpFloat * tmpFloat < LIMIT) {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -541,13 +714,13 @@ testcase f_test_sqrtF() runs on Maths_CT
 testcase f_test_sqrtI() runs on Maths_CT
 {
   log(" ----------- f_sqrtI ----------- ");
-  
+
   tmpFloat := f_sqrtI(2);
   log("Square root of 2: ", tmpFloat);
 
   tmpFloat := tmpFloat - 1.4142145;
-  if ( tmpFloat * tmpFloat < LIMIT) { 
-    setverdict(pass); 
+  if ( tmpFloat * tmpFloat < LIMIT) {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -555,12 +728,12 @@ testcase f_test_sqrtI() runs on Maths_CT
 testcase f_test_ceil() runs on Maths_CT
 {
   log(" ----------- f_ceil ----------- ");
-  
+
   tmpInt := f_ceil(3.1);
   log("ceil of 3.1: ", tmpInt);
 
-  if (tmpInt == 4) { 
-    setverdict(pass); 
+  if (tmpInt == 4) {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -568,12 +741,12 @@ testcase f_test_ceil() runs on Maths_CT
 testcase f_test_floor() runs on Maths_CT
 {
   log(" ----------- f_floor ----------- ");
-  
+
   tmpInt := f_floor(3.1);
   log("ceil of 3.1: ", tmpInt);
 
-  if ( tmpInt == 3) { 
-    setverdict(pass); 
+  if ( tmpInt == 3) {
+    setverdict(pass);
   }
   else { setverdict(fail); }
 }
@@ -592,9 +765,9 @@ testcase f_test_poisson() runs on Maths_CT
     vl_success:=f_generate_poissonTable(i,vl_poissonTable);
     log("Poisson table Nr:",i," ,",vl_success);
     log(vl_poissonTable);
-    
+
   }
-  setverdict(pass); 
+  setverdict(pass);
 }
 
 testcase f_test_next_poisson() runs on Maths_CT
@@ -611,9 +784,9 @@ testcase f_test_next_poisson() runs on Maths_CT
     vl_nextValue := f_getNext_poissonValue(i, vl_poissonTable, vl_success);
 
     log("Next Poisson value:",vl_nextValue," ,",vl_success);
-    log(vl_poissonTable);    
+    log(vl_poissonTable);
   }
-  setverdict(pass); 
+  setverdict(pass);
 }
 
 
@@ -650,7 +823,7 @@ control
   execute(f_test_acos());
   execute(f_test_powFF());
   execute(f_test_powII());
-  execute(f_test_powIF()); 
+  execute(f_test_powIF());
   execute(f_test_powFI());
   execute(f_test_powFF_cubicRootOfTwo());
   execute(f_test_sqrF());
@@ -659,10 +832,10 @@ control
   execute(f_test_sqrtI());
   execute(f_test_ceil());
   execute(f_test_floor());
-  
+
   //poisson
   execute(f_test_poisson());
-  execute(f_test_next_poisson());      
+  execute(f_test_next_poisson());
 }
 
 }
diff --git a/demo/TCCMessageHandling_Example.ttcn b/demo/TCCMessageHandling_Example.ttcn
index 6aa78dc2778d0c558dad77f7509c2698060806d5..c98c05866d12691e054ec36ccca8f0a94600bd32 100644
--- a/demo/TCCMessageHandling_Example.ttcn
+++ b/demo/TCCMessageHandling_Example.ttcn
@@ -1,17 +1,16 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2013                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCMessageHandling_Example.ttcn
 //  Description:        TCC Useful Functions: Message Handling Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2013-03-28
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCPermutatedParameters_Example.ttcn b/demo/TCCPermutatedParameters_Example.ttcn
index 67190b737b2c004ed4e0dad25dbbb4d60ad04d63..a4e58d5d778aabd27ee15f06b19e1e9c1fd58174 100644
--- a/demo/TCCPermutatedParameters_Example.ttcn
+++ b/demo/TCCPermutatedParameters_Example.ttcn
@@ -1,11 +1,13 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
+///////////////////////////////////////////////////////////////////////////////
 
-******************************************************************************/
 
 module TCCPermutatedParameters_Example {
 
diff --git a/demo/TCCRegexp_Example.ttcn b/demo/TCCRegexp_Example.ttcn
new file mode 100644
index 0000000000000000000000000000000000000000..53485751ca2a696ad9cd21c6a6d6012f1f1c240c
--- /dev/null
+++ b/demo/TCCRegexp_Example.ttcn
@@ -0,0 +1,52 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
+///////////////////////////////////////////////////////////////////////////////
+//
+//  File:               TCCRegexp_Example.ttcn
+//  Description:        TCC Useful Functions: Regular Expression Functions.
+//  Rev:                R30A
+//  Prodnr:             CNL 113 472
+//  Contact:            http://ttcn.ericsson.se
+///////////////////////////////////////////////
+module TCCRegexp_Example
+{
+import from TCCRegexp_Functions all;
+
+type component Test_CT{}
+
+
+testcase tc_1() runs on Test_CT
+  {
+
+    var charstring vl_subject := "a :1 2\nb:1 2\na :2 3";
+    var charstring vl_pattern := "a :(\\d+) (\\d+)";
+
+    var integer    vl_groupno := 0;
+    var charstring vl_expected := "a :1 2";
+    var charstring vl_result := f_pcre_regexp(vl_subject, vl_pattern, vl_groupno);
+    log(vl_result);
+    if(vl_result == vl_expected) {setverdict(pass)} else {setverdict(fail)}
+
+    var charstring_list vl_expected2 := {"a :1 2", "1", "2"};
+    var charstring_list vl_result2 := f_pcre_regexp_list(vl_subject, vl_pattern);
+    log(vl_result2)
+    if(vl_result2 == vl_expected2) {setverdict(pass)} else {setverdict(fail)}
+
+    var t_list_of_charstring_list vl_expected3 := {{"a :1 2", "1", "2"},{"a :2 3", "2", "3"}};
+    var t_list_of_charstring_list vl_result3 := f_pcre_regexp_list_all_matches(vl_subject, vl_pattern);
+    log(vl_result3)
+    if(vl_result3 == vl_expected3) {setverdict(pass)} else {setverdict(fail)}
+  }
+control
+{
+  execute(tc_1()) 
+}
+
+
+}
diff --git a/demo/TCCTemplate_Example.ttcn b/demo/TCCTemplate_Example.ttcn
index 0c4570caae1f81e5f01b9aebc959eb3eeca95aca..44c9c459f616f12958eb71d2bb18c96b2d8043bf 100644
--- a/demo/TCCTemplate_Example.ttcn
+++ b/demo/TCCTemplate_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCTemplate_Example.ttcn
 //  Description:        TCC Useful Functions: Template Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2007-12-20
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCTitanMetadata_Example.ttcn b/demo/TCCTitanMetadata_Example.ttcn
index c7265d3468b4b16a860e5b2c39c98c9ac8320890..91f4efd3d219fe4aad0ce93f693dd2bf88f840c0 100644
--- a/demo/TCCTitanMetadata_Example.ttcn
+++ b/demo/TCCTitanMetadata_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCTitanMetadata_Example.ttcn
 //  Description:        TCC Useful Functions: Titan Metadata Functions.
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2007-11-14
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCXPathSupport_Example.ttcn b/demo/TCCXPathSupport_Example.ttcn
index d3bd561e852364089ec5a35e6549bcf1e4f009f4..3b8f110e276420a89251f277aaa759f7d4cb4606 100644
--- a/demo/TCCXPathSupport_Example.ttcn
+++ b/demo/TCCXPathSupport_Example.ttcn
@@ -1,16 +1,16 @@
-/******************************************************************************
-* Copyright (c) 2004, 2015  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
-
-******************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCXPathSupport_Example.ttcn
 //  Description:        TCC Useful Functions: XPath Support Functions
-//  Rev:                R22B
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
 //  Updated:            2008-09-04
 //  Contact:            http://ttcn.ericsson.se
diff --git a/doc/TCCUsefulFunctions_CNL113472_1551.doc b/doc/TCCUsefulFunctions_CNL113472_1551.doc
index b82cc3a68ff785e12d9836e3b820fdf3cc504863..1ae7690e94907c6ac2e85a3aa75789ffb477a29c 100644
Binary files a/doc/TCCUsefulFunctions_CNL113472_1551.doc and b/doc/TCCUsefulFunctions_CNL113472_1551.doc differ
diff --git a/doc/TCCUsefulFunctions_CNL113472_PRI.doc b/doc/TCCUsefulFunctions_CNL113472_PRI.doc
index a56962994c8b617bb5afdeeeb252a68cce4254b9..d90970b743c58ed176fc9063cc44ae4fa12e7614 100644
Binary files a/doc/TCCUsefulFunctions_CNL113472_PRI.doc and b/doc/TCCUsefulFunctions_CNL113472_PRI.doc differ
diff --git a/doc/apidoc/Data/ClassHierarchy.nd b/doc/apidoc/Data/ClassHierarchy.nd
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Data/ConfigFileInfo.nd b/doc/apidoc/Data/ConfigFileInfo.nd
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Data/FileInfo.nd b/doc/apidoc/Data/FileInfo.nd
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Data/ImageFileInfo.nd b/doc/apidoc/Data/ImageFileInfo.nd
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Data/ImageReferenceTable.nd b/doc/apidoc/Data/ImageReferenceTable.nd
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Data/IndexInfo.nd b/doc/apidoc/Data/IndexInfo.nd
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Data/PreviousMenuState.nd b/doc/apidoc/Data/PreviousMenuState.nd
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Data/PreviousSettings.nd b/doc/apidoc/Data/PreviousSettings.nd
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Data/SymbolTable.nd b/doc/apidoc/Data/SymbolTable.nd
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Menu.txt b/doc/apidoc/Menu.txt
old mode 100644
new mode 100755
diff --git a/doc/apidoc/Menu.txt~ b/doc/apidoc/Menu.txt~
deleted file mode 100644
index f53b1c2bd571f1e6f195a2fb56a896190ba3e9ea..0000000000000000000000000000000000000000
--- a/doc/apidoc/Menu.txt~
+++ /dev/null
@@ -1,165 +0,0 @@
-Format: 1.4
-
-
-Title: TCCUsefulFunctions
-SubTitle: R12A02
-
-Footer: Copyright 2012 Test Competence Center<br/><a href="http://ttcn.ericsson.se/">http://ttcn.ericsson.se</a>
-
-# You can add a timestamp to your documentation like one of these:
-# Timestamp: Generated on month day, year
-# Timestamp: Updated mm/dd/yyyy
-# Timestamp: Last updated mon day
-#
-#   m     - One or two digit month.  January is "1"
-#   mm    - Always two digit month.  January is "01"
-#   mon   - Short month word.  January is "Jan"
-#   month - Long month word.  January is "January"
-#   d     - One or two digit day.  1 is "1"
-#   dd    - Always two digit day.  1 is "01"
-#   day   - Day with letter extension.  1 is "1st"
-#   yy    - Two digit year.  2006 is "06"
-#   yyyy  - Four digit year.  2006 is "2006"
-#   year  - Four digit year.  2006 is "2006"
-
-
-# --------------------------------------------------------------------------
-# 
-# Cut and paste the lines below to change the order in which your files
-# appear on the menu.  Don't worry about adding or removing files, Natural
-# Docs will take care of that.
-# 
-# You can further organize the menu by grouping the entries.  Add a
-# "Group: [name] {" line to start a group, and add a "}" to end it.
-# 
-# You can add text and web links to the menu by adding "Text: [text]" and
-# "Link: [name] ([URL])" lines, respectively.
-# 
-# The formatting and comments are auto-generated, so don't worry about
-# neatness when editing the file.  Natural Docs will clean it up the next
-# time it is run.  When working with groups, just deal with the braces and
-# forget about the indentation and comments.
-# 
-# --------------------------------------------------------------------------
-
-
-Group: Aka-algorythm  {
-
-   File: aka_algorythm_set.h  (aka_algorythm_set.h)
-   }  # Group: Aka-algorythm
-
-Group: Assertion  {
-
-   File: f__assert  (TCCAssertion.cc)
-   File: TCCAssertion_Functions  (TCCAssertion_Functions.ttcn)
-   }  # Group: Assertion
-
-Group: Conversion  {
-
-   File: TCCConversion.cc  (TCCConversion.cc)
-   File: TCCConversion_Functions  (TCCConversion_Functions.ttcn)
-   }  # Group: Conversion
-
-Group: Date-Time  {
-
-   File: TCCDateTime.cc  (TCCDateTime.cc)
-   File: TCCDateTime_Functions  (TCCDateTime_Functions.ttcn)
-   }  # Group: Date-Time
-
-Group: Digcalc  {
-
-   File: digcalc.h  (digcalc.h)
-   }  # Group: Digcalc
-
-Group: Encoding  {
-
-   File: TCCEncoding.cc  (TCCEncoding.cc)
-   File: TCCEncoding_Functions  (TCCEncoding_Functions.ttcn)
-   }  # Group: Encoding
-
-Group: Env  {
-
-   File: TCCEnv.cc  (TCCEnv.cc)
-   File: TCCEnv_Functions  (TCCEnv_Functions.ttcn)
-   }  # Group: Env
-
-Group: File  {
-
-   File: TCCFileIO.cc  (TCCFileIO.cc)
-   File: TCCFileIO_Functions  (TCCFileIO_Functions.ttcn)
-   File: TCCFileSystem_Functions  (TCCFileSystem_Functions.ttcn)
-   }  # Group: File
-
-Group: IP  {
-
-   File: TCCIPsec_Definitions.ttcn  (TCCIPsec_Definitions.ttcn)
-   File: TCCIPsec_Functions  (TCCIPsec_Functions.ttcn)
-   }  # Group: IP
-
-Group: Interface  {
-
-   File: TCCInterface.cc  (TCCInterface.cc)
-   File: TCCInterface_Functions  (TCCInterface_Functions.ttcn)
-   }  # Group: Interface
-
-Group: Math  {
-
-   File: TCCMaths.cc  (TCCMaths.cc)
-   File: TCCMaths_Functions  (TCCMaths_Functions.ttcn)
-   File: TCCMaths_GenericTypes  (TCCMaths_GenericTypes.ttcn)
-   }  # Group: Math
-
-Group: Message-Handling  {
-
-   File: TCCMessageHandling_Functions  (TCCMessageHandling_Functions.ttcn)
-   }  # Group: Message-Handling
-
-Group: Regexp  {
-
-   File: Regexp_Functions  (TCCRegexp_Functions.ttcn)
-   }  # Group: Regexp
-
-Group: Security  {
-
-   File: TCCSecurity.cc  (TCCSecurity.cc)
-   File: TCCSecurity_Functions  (TCCSecurity_Functions.ttcn)
-   }  # Group: Security
-
-Group: System  {
-
-   File: f_SYS_getpid  (TCCSystem.cc)
-   File: f_SYS_getpid  (TCCSystem_Functions.ttcn)
-   }  # Group: System
-
-Group: Template  {
-
-   File: TCCTemplate_Functions  (TCCTemplate_Functions.ttcn)
-   }  # Group: Template
-
-Group: Titan-Metadata  {
-
-   File: f__compilationTime  (TCCTitanMetadata.cc)
-   File: TCCTitanMetadata_Functions  (TCCTitanMetadata_Functions.ttcn)
-   }  # Group: Titan-Metadata
-
-Group: XPath-Support  {
-
-   File: TCCXPathSupport_Functions  (TCCXPathSupport_Functions.ttcn)
-   File: XPathQuery  (TCCXPathSupport.cc)
-   }  # Group: XPath-Support
-
-Group: Zuc  {
-
-   File: zuc.h  (zuc.h)
-   }  # Group: Zuc
-
-Group: Index  {
-
-   Index: Everything
-   Constant Index: Constants
-   File Index: Files
-   Function Index: Functions
-   Type Index: Types
-   Variable Index: Variables
-   }  # Group: Index
-
diff --git a/doc/apidoc/html/index.html~ b/doc/apidoc/html/index.html~
deleted file mode 100644
index 95dcc7c7b61c7dd89026592594bb94f93dcf5b20..0000000000000000000000000000000000000000
--- a/doc/apidoc/html/index.html~
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">
-<html>
-<head>
-<title>TCCUsefulFunctions</title></head>
-
-<!--  Copyright (c) 2015 Ericsson -->
-
-<frameset cols="250,*">
-  <frame name=Menu src="menu.html">
-  <frame name=Content src="files/TCCUsefulFunctions.html">
-</frameset>
-
-<noframes>
-This documentation was designed for use with frames.  However, you can still use it by <a href="menu.html">starting from the menu page</a>.
-<script language=JavaScript>
-<!--
-location.href="menu.html";
-// -->
-</script>
-</noframes>
-</html>
diff --git a/doc/apidoc/html/javascript/main.js b/doc/apidoc/html/javascript/main.js
old mode 100644
new mode 100755
diff --git a/doc/apidoc/html/javascript/searchdata.js b/doc/apidoc/html/javascript/searchdata.js
old mode 100644
new mode 100755
diff --git a/doc/apidoc/html/menu.html~ b/doc/apidoc/html/menu.html~
deleted file mode 100644
index f637c1d4b9919c7893daa1f38953b25a20fa078f..0000000000000000000000000000000000000000
--- a/doc/apidoc/html/menu.html~
+++ /dev/null
@@ -1,254 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
-
-<html>
-<head>
-<title>Menu - TCCUsefulFunctions</title>
-<base target="Content">
-<link rel="stylesheet" type="text/css" href="styles/main.css">
-<script language=JavaScript src="javascript/main.js"></script>
-<script language=JavaScript src="javascript/searchdata.js"></script></head>
-<body class="FramedMenuPage" onLoad="NDOnLoad()">
-<script language=JavaScript>
-<!--
-if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
-
-<!--  Generated by Natural Docs, version 1.4 -->
-<!--  http://www.naturaldocs.org  -->
-
-<!-- saved from url=(0026)http://www.naturaldocs.org -->
-
-
-
-
-<div id=Menu>
-<div class=MTitle>TCCUsefulFunctions<div class=MSubTitle>R12A02</div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent1')" target="_self">Aka-algorythm</a>
-<div class=MGroupContent id=MGroupContent1>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/aka_algorythm_set-h.html">aka_algorythm_set.h</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent2')" target="_self">Assertion</a>
-<div class=MGroupContent id=MGroupContent2>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCAssertion-cc.html">f__assert</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCAssertion_Functions-ttcn.html">TCCAssertion_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent3')" target="_self">Conversion</a>
-<div class=MGroupContent id=MGroupContent3>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCConversion-cc.html">TCCConversion.cc</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCConversion_Functions-ttcn.html">TCCConversion_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent4')" target="_self">Date-Time</a>
-<div class=MGroupContent id=MGroupContent4>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCDateTime-cc.html">TCCDateTime.cc</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCDateTime_Functions-ttcn.html">TCCDateTime_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent5')" target="_self">Digcalc</a>
-<div class=MGroupContent id=MGroupContent5>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/digcalc-h.html">digcalc.h</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent6')" target="_self">Encoding</a>
-<div class=MGroupContent id=MGroupContent6>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCEncoding-cc.html">TCCEncoding.cc</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCEncoding_Functions-ttcn.html">TCCEncoding_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent7')" target="_self">Env</a>
-<div class=MGroupContent id=MGroupContent7>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCEnv-cc.html">TCCEnv.cc</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCEnv_Functions-ttcn.html">TCCEnv_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent8')" target="_self">File</a>
-<div class=MGroupContent id=MGroupContent8>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCFileIO-cc.html">TCCFileIO.cc</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCFileIO_Functions-ttcn.html">TCCFileIO_Functions</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCFileSystem_Functions-ttcn.html">TCCFileSystem_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent9')" target="_self">IP</a>
-<div class=MGroupContent id=MGroupContent9>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCIPsec_Definitions-ttcn.html">TCCIPsec_Definitions.ttcn</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCIPsec_Functions-ttcn.html">TCCIPsec_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent10')" target="_self">Interface</a>
-<div class=MGroupContent id=MGroupContent10>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCInterface-cc.html">TCCInterface.cc</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCInterface_Functions-ttcn.html">TCCInterface_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent11')" target="_self">Math</a>
-<div class=MGroupContent id=MGroupContent11>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCMaths-cc.html">TCCMaths.cc</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCMaths_Functions-ttcn.html">TCCMaths_Functions</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCMaths_GenericTypes-ttcn.html">TCCMaths_GenericTypes</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent12')" target="_self">Message-Handling</a>
-<div class=MGroupContent id=MGroupContent12>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCMessageHandling_Functions-ttcn.html">TCCMessageHandling_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent13')" target="_self">Regexp</a>
-<div class=MGroupContent id=MGroupContent13>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCRegexp_Functions-ttcn.html">Regexp_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent14')" target="_self">Security</a>
-<div class=MGroupContent id=MGroupContent14>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCSecurity-cc.html">TCCSecurity.cc</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCSecurity_Functions-ttcn.html">TCCSecurity_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent15')" target="_self">System</a>
-<div class=MGroupContent id=MGroupContent15>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCSystem-cc.html">f_SYS_getpid</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCSystem_Functions-ttcn.html">f_SYS_getpid</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent16')" target="_self">Template</a>
-<div class=MGroupContent id=MGroupContent16>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCTemplate_Functions-ttcn.html">TCCTemplate_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent17')" target="_self">Titan-Metadata</a>
-<div class=MGroupContent id=MGroupContent17>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCTitanMetadata-cc.html">f__compilationTime</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCTitanMetadata_Functions-ttcn.html">TCCTitanMetadata_Functions</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent18')" target="_self">XPath-Support</a>
-<div class=MGroupContent id=MGroupContent18>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCXPathSupport_Functions-ttcn.html">TCCXPathSupport_Functions</a></div></div>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/TCCXPathSupport-cc.html">XPathQuery</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent19')" target="_self">Zuc</a>
-<div class=MGroupContent id=MGroupContent19>
-<div class=MEntry>
-<div class=MFile>
-<a href="files/zuc-h.html">zuc.h</a></div></div></div></div></div>
-<div class=MEntry>
-<div class=MGroup>
-<a href="javascript:ToggleMenu('MGroupContent20')" target="_self">Index</a>
-<div class=MGroupContent id=MGroupContent20>
-<div class=MEntry>
-<div class=MIndex>
-<a href="index/General.html">Everything</a></div></div>
-<div class=MEntry>
-<div class=MIndex>
-<a href="index/Constants.html">Constants</a></div></div>
-<div class=MEntry>
-<div class=MIndex>
-<a href="index/Files.html">Files</a></div></div>
-<div class=MEntry>
-<div class=MIndex>
-<a href="index/Functions.html">Functions</a></div></div>
-<div class=MEntry>
-<div class=MIndex>
-<a href="index/Types.html">Types</a></div></div>
-<div class=MEntry>
-<div class=MIndex>
-<a href="index/Variables.html">Variables</a></div></div></div></div></div>
-<script type="text/javascript">
-<!--
-var searchPanel = new SearchPanel("searchPanel", "FramedHTML", "search");
---></script>
-<div id=MSearchPanel class=MSearchPanelInactive>
-<input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()">
-<select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()">
-<option  id=MSearchEverything selected value="General">Everything</option>
-<option value="Constants">Constants</option>
-<option value="Files">Files</option>
-<option value="Functions">Functions</option>
-<option value="Types">Types</option>
-<option value="Variables">Variables</option></select></div>
-<script language=JavaScript>
-<!--
-HideAllBut([], 21);// --></script></div>
-<!--Menu-->
-
-
-<div id=Footer>
-<p>Copyright 2012 Test Competence Center<br/>
-<a href="http://ttcn.ericsson.se/">http://ttcn.ericsson.se</a></p>
-<p>
-<a href="http://www.naturaldocs.org">Generated by Natural Docs</a></p></div>
-<!--Footer-->
-
-
-<script language=JavaScript>
-<!--
-if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>
\ No newline at end of file
diff --git a/doc/apidoc/html/styles/1.css b/doc/apidoc/html/styles/1.css
old mode 100644
new mode 100755
diff --git a/doc/apidoc/html/styles/2.css b/doc/apidoc/html/styles/2.css
old mode 100644
new mode 100755
diff --git a/doc/apidoc/html/styles/main.css b/doc/apidoc/html/styles/main.css
old mode 100644
new mode 100755
diff --git a/src/TCCAssertion.cc b/src/TCCAssertion.cc
index 41b38e3a9c63975d82769677126a2c2c36265d7f..03d0d96a5bc908cf060e00c68a069674d09d433a 100644
--- a/src/TCCAssertion.cc
+++ b/src/TCCAssertion.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2007                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCAssertion.cc
 //  Description:        TCC Useful Functions: Assert Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2007-11-12
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCAssertion_Functions.ttcn b/src/TCCAssertion_Functions.ttcn
index 28bb7ad7e95e26ff76455e699bb9549c88656aca..526c950b8fe53cee8a1cee7fc38f430882912493 100644
--- a/src/TCCAssertion_Functions.ttcn
+++ b/src/TCCAssertion_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2007                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCAssertion_Functions.ttcn
 //  Description:        TCC Useful Functions: Assert Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2007-11-12
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCConversion.cc b/src/TCCConversion.cc
index 668203aac3ef1462b7ba78595d19d379ebb50700..6d5f58a78ce0df434e7a95732d92067a1490dd69 100644
--- a/src/TCCConversion.cc
+++ b/src/TCCConversion.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2013                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCConversion.cc
 //  Description:        TCC Useful Functions: Conversion Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2013-04-15
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCConversion_Functions.ttcn b/src/TCCConversion_Functions.ttcn
index c828ac6f70094622915af4cf5dd8f779cca0021e..b4df9b6d9dbe172609e47b136035fd0d45bf5a3f 100644
--- a/src/TCCConversion_Functions.ttcn
+++ b/src/TCCConversion_Functions.ttcn
@@ -1,19 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2016                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCConversion_Functions.ttcn
 //  Description:        TCC Useful Functions: Conversion Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -971,5 +969,5 @@ return boolean
 
 }//end of module
 with {
-extension "version R25A"}
+extension "version R30A"}
 
diff --git a/src/TCCDateTime.cc b/src/TCCDateTime.cc
index 68a73a176c808dc5e33903e156051b49764cce1f..553426f205145721946c5ef6ffa98f8515fede1a 100644
--- a/src/TCCDateTime.cc
+++ b/src/TCCDateTime.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2011                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCDateTime.cc
 //  Description:        TCC Useful Functions: DateTime Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2011-06-29
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCDateTime_Functions.ttcn b/src/TCCDateTime_Functions.ttcn
index 023c0f0d58442f282a7ef9cb30bbc43e0ea18ad2..2be3f65640b3ce72d2fad8b63911781d0a91a1f4 100644
--- a/src/TCCDateTime_Functions.ttcn
+++ b/src/TCCDateTime_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2007                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCDateTime_Functions.ttcn
 //  Description:        TCC Useful Functions: DateTime Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2011-06-29
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCEncoding.cc b/src/TCCEncoding.cc
index 9df864ae17a7eee02357c3d8fee02e404aee6111..00f4d07ed3b04d993f728fcc30b77b0ccc5a4243 100644
--- a/src/TCCEncoding.cc
+++ b/src/TCCEncoding.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2012                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCEncoding.cc
 //  Description:        TCC Useful Functions: Message Encoding Functions.
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2012-06-28
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCEncoding_Functions.ttcn b/src/TCCEncoding_Functions.ttcn
index 603ceb1510b15c60b6127fbd924b456c1e8bf9ed..b9f721a5e88c67dc3bac815f0ac3752a13fcc437 100644
--- a/src/TCCEncoding_Functions.ttcn
+++ b/src/TCCEncoding_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2013                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCEncoding_Functions.ttcn
 //  Description:        TCC Useful Functions: Message Encoding Functions.
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2013-08-05
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -733,4 +730,4 @@ public function f_enc_TBCD_hex(in hexstring pl_hex) return octetstring
   return vl_oct;
 }
 
-} with {extension "version R25A"}
+} with {extension "version R30A"}
diff --git a/src/TCCEnv.cc b/src/TCCEnv.cc
index d35c2a353b1f9e04d5a196d558305d5867cadad1..de7bb1e06c5d7b7022226883a4e7f87dcc9edf5f 100644
--- a/src/TCCEnv.cc
+++ b/src/TCCEnv.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2008                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCEnv.cc
 //  Description:        TCC Useful Functions: Environment Handling Functions.
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2008-01-18
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCEnv_Functions.ttcn b/src/TCCEnv_Functions.ttcn
index a1e45e2a2489268a0dfa4e4fbeeafb446a8e1718..57d05c8b54f850770cfeb640d2208e140fcd6382 100644
--- a/src/TCCEnv_Functions.ttcn
+++ b/src/TCCEnv_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2008                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCEnv_Functions.ttcn
 //  Description:        TCC Useful Functions: Environment Handling Functions.
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2008-01-18
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCFileIO.cc b/src/TCCFileIO.cc
index 09b0b214884ae524e5e074ca6b42ac3d56bfd95c..91be44a0c02b94ed47b5f1d722034ae9fed579b0 100644
--- a/src/TCCFileIO.cc
+++ b/src/TCCFileIO.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2009                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCFileIO.cc
 //  Description:        TCC Useful Functions: FileIO Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2009-04-09
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -31,6 +28,7 @@
 #include <map>
 #include <string>
 #include <sstream>
+#include <dirent.h>
 
 
 #define BUF_SIZE 512
@@ -1098,6 +1096,35 @@ BOOLEAN f__FIO__rmdir(const CHARSTRING& pl__dir__name)
     return TRUE;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__FIO__remove
+//
+//  Purpose:
+//    Removes folder or a directory
+//
+//  Parameters:
+//    pl_file_name - *in* *charstring* - name of the folder/directory to remove
+//
+//  Return Value:
+//    boolean - indicate the successful or unsuccessful target removal
+//
+//  Errors:
+//    In the case of unsuccessful operation the cause of the error can be
+//    queried  by the f_FIO_get_error_code, f_FIO_get_error_string functions
+//
+///////////////////////////////////////////////////////////////////////////////
+BOOLEAN f__FIO__remove(const CHARSTRING& pl__file__name)
+{
+  if(remove((const char *)(pl__file__name)))
+  {
+    f__FIO__realize__error ("f__FIO__remove",
+                "Cannot remove ", __FILE__, __LINE__);
+    return FALSE;
+  }
+  else
+    return TRUE;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_FIO_fileOrDirExists
 // 
@@ -1335,4 +1362,33 @@ BOOLEAN f__FIO__chmod(const CHARSTRING& p__name,
   return TRUE;
 }
 
+INTEGER f__FIO__fileSize(const CHARSTRING& filename ) {
+  struct stat buffer ;
+  if(stat( (const char *)filename, &buffer )==0) {
+    return INTEGER(buffer.st_size);
+  }
+  else{return INTEGER (-1);}
+}
+
+BOOLEAN f__FIO__fileList(const CHARSTRING& dirname, FileList& filelist) {
+  struct dirent *pent;
+  DIR *pdir;
+  pdir=opendir((const char *)dirname);
+  if(!pdir) {
+    return FALSE;
+  }
+  else{
+    errno=0;
+    int i=0;
+    while((pent=readdir(pdir)))
+    {
+      filelist[i] = (pent->d_name);
+      i = i+1;
+    }
+    closedir(pdir);
+    if (errno){return FALSE;}
+    return TRUE;
+  }
+}
+
 }
diff --git a/src/TCCFileIO_Functions.ttcn b/src/TCCFileIO_Functions.ttcn
index f78878be7e1620f02af4327fdab3bff04e938895..94b5bc61f4ee133e1006f1fa7766fcf644c45da1 100644
--- a/src/TCCFileIO_Functions.ttcn
+++ b/src/TCCFileIO_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2009                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCFileIO_Functions.ttcn
 //  Description:        TCC Useful Functions: FileIO Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2009-04-09
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -412,6 +409,25 @@ external function f_FIO_chdir (in charstring pl_name) return boolean;
 ///////////////////////////////////////////////////////////////////////////////
 external function f_FIO_mkdir (in charstring p_dir_name) return boolean;
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_FIO_remove
+//
+//  Purpose:
+//    Removes folder or a directory
+//
+//  Parameters:
+//    pl_file_name - *in* *charstring* - name of the folder/directory to remove
+//
+//  Return Value:
+//    boolean - indicate the successful or unsuccessful target removal
+//
+//  Errors:
+//    In the case of unsuccessful operation the cause of the error can be
+//    queried  by the f_FIO_get_error_code, f_FIO_get_error_string functions
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_FIO_remove (in charstring pl_file_name) return boolean;
+
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_FIO_rmdir
 // 
@@ -548,4 +564,49 @@ external function f_FIO_stat (in charstring p_name,
 external function f_FIO_chmod (in charstring p_name,
                                in FIO_permissions p_permissions) return boolean;
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_FIO_fileSize
+// 
+//  Purpose:
+//    Query the size of the file.
+//
+//  Parameters:
+//    p_name - *in* *charstring* - name of the file to check
+// 
+//  Return Value:
+//    integer - the size of the file in bytes, or -1 on error
+//
+//  Errors:
+//    -
+// 
+//  Detailed description:
+//    -
+// 
+///////////////////////////////////////////////////////////////////////////////
+external function f_FIO_fileSize (in charstring p_name) return integer;
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_FIO_fileList
+// 
+//  Purpose:
+//    Query the contents of a directory.
+//
+//  Parameters:
+//    p_name - *in* *charstring* - name of the directory to check
+//    p_files - *inout* *FileList* - the contents of the directory
+// 
+//  Return Value:
+//    boolean - indicate sucessfull execution
+//
+//  Errors:
+//    -
+// 
+//  Detailed description:
+//    -
+// 
+///////////////////////////////////////////////////////////////////////////////
+type record of charstring FileList;
+external function f_FIO_fileList (in charstring p_name,
+                                  inout FileList p_files) return boolean;
+
 }
diff --git a/src/TCCFileSystem.cc b/src/TCCFileSystem.cc
index 4cc851a634356af8ee6cd0beac0671dabc71b185..eae95786dad6a3e32d031d5ea85b1ad0824f4b5b 100644
--- a/src/TCCFileSystem.cc
+++ b/src/TCCFileSystem.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2011                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCFileSystem.cc
 //  Description:        TCC Useful Functions: FileSystem Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2011-07-14
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCFileSystem_Functions.ttcn b/src/TCCFileSystem_Functions.ttcn
index 62b96ba55fe7d1014824a3a9df02517c02c49635..5606ccf0a736b6975125403915e734fcbb2dd895 100644
--- a/src/TCCFileSystem_Functions.ttcn
+++ b/src/TCCFileSystem_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2011                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCC_FileSystem_Functions.ttcn
 //  Description:        TCC Useful Functions: FileSystem Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2011-07-14
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCIPsec.cc b/src/TCCIPsec.cc
index 4dc4224bb21afa94d16c474a4f403f34c46f5838..06dcc7852e683fab8f6d7a8fb1d5182114a0b65f 100644
--- a/src/TCCIPsec.cc
+++ b/src/TCCIPsec.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2016                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCIPsec.cc
 //  Description:        TCC Useful Functions: IPsec Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2012-10-31
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCIPsec_Definitions.ttcn b/src/TCCIPsec_Definitions.ttcn
index 7d2fed5c80d5fac5feccc3ba72333b302e4006a2..49e2d4d13d3d69d9876b88c4fe88100cb6c0d430 100644
--- a/src/TCCIPsec_Definitions.ttcn
+++ b/src/TCCIPsec_Definitions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2012                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCIPsec_Definitions.ttcn
 //  Description:        TCC Useful Functions: Definitions for IPsec functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2012-10-31
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCIPsec_Functions.ttcn b/src/TCCIPsec_Functions.ttcn
index 5300418204be6d7fcbb072007a24ef1bc56db247..f831e11aa126d4f37282e6292df4bcdb1679f237 100644
--- a/src/TCCIPsec_Functions.ttcn
+++ b/src/TCCIPsec_Functions.ttcn
@@ -1,19 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2016                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCIPsec_Functions.ttcn
 //  Description:        TCC Useful Functions: IPsec Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCIPsec_XFRM.cc b/src/TCCIPsec_XFRM.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3c8ad7f18d8e3753c4fab4a3ca8d5629e5a88f91
--- /dev/null
+++ b/src/TCCIPsec_XFRM.cc
@@ -0,0 +1,358 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
+///////////////////////////////////////////////////////////////////////////////
+//
+//  File:               TCCIPsec_XFRM.cc
+//  Description:        TCC Useful Functions: IPsec XFRM Functions
+//  Rev:                R30A
+//  Prodnr:             CNL 113 472
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <asm/types.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <time.h>
+#include <signal.h>
+
+#ifdef LINUX
+  #include <linux/netlink.h>
+#else
+  #include <net/netlink.h>
+#endif
+
+#include "TCCIPsec_XFRM_Definitions.hh"
+#include "TCCIPsec_XFRM.hh"
+#include "Logger.hh"
+
+class Message{
+public: 
+  void* memory;
+public:
+  Message(int size){
+    memory  =  Malloc(size);
+  }
+
+  ~Message(){
+    Free(memory); //so no one forgets to free the allocated memory :)
+  }
+}; //end of class Message
+
+namespace TCCIPsec__XFRM__Definitions {
+
+XFRM__Result send(int fd, void* msg, int len, unsigned long* spi) {
+  struct msghdr smsg;
+  struct iovec siov;
+  struct sockaddr_nl dest;
+  char recvbuf[4096];
+  struct msghdr rmsg;
+  struct iovec riov;
+  struct sockaddr_nl from;
+  struct nlmsghdr* hdr;
+  int rlen;
+
+  memset(&dest,0,sizeof(dest));
+  dest.nl_family = AF_NETLINK;
+  smsg.msg_name = (void*)&dest;
+  smsg.msg_namelen = sizeof(dest);
+  smsg.msg_iov = &siov;
+  smsg.msg_iovlen = 1;
+  smsg.msg_control = NULL;
+  smsg.msg_controllen = 0;
+  smsg.msg_flags = 0;
+  
+  siov.iov_base = msg;
+  siov.iov_len = len;
+
+  //Sending message to the kernel
+  if(sendmsg(fd,&smsg,0) == -1){
+    close(fd);
+    return XFRM__Result(-1,"TCCIPsec XFRM: Netlink socket send failed.");
+  }
+
+  TTCN_Logger::log( TTCN_DEBUG,"###### Netlink socket sent.");
+  //Initializing reciever
+  riov.iov_base = recvbuf;
+  riov.iov_len = 4096;
+  rmsg.msg_name = &from;
+  rmsg.msg_namelen = sizeof(from);
+  rmsg.msg_iov = &riov;
+  rmsg.msg_iovlen = 1;
+  rmsg.msg_control = NULL;
+  rmsg.msg_controllen = 0;
+  rmsg.msg_flags = 0;
+
+  TTCN_Logger::log( TTCN_DEBUG,"###### Receiving results from the kernel:");
+  rlen = recvmsg(fd,&rmsg,0);
+  if(rlen == -1) {
+    close(fd);
+    return XFRM__Result(-1,"TCCIPsec XFRM: Error in receiving message from the kernel!"); 
+  };
+
+  //Processing response
+  //Message Format:
+  // <--- nlmsg_total_size(payload)  --->
+  // <-- nlmsg_msg_size(payload) ->
+  //+----------+- - -+-------------+- - -+-------- - -
+  //| nlmsghdr | Pad |   Payload   | Pad | nlmsghdr
+  //+----------+- - -+-------------+- - -+-------- - -
+  //nlmsg_data(nlh)---^                   ^
+  //nlmsg_next(nlh)-----------------------+
+  for(hdr = (struct nlmsghdr*)recvbuf; NLMSG_OK(hdr,(unsigned)rlen); hdr = NLMSG_NEXT(hdr,rlen)){
+    if(hdr -> nlmsg_type == NLMSG_ERROR){
+      struct nlmsgerr* answer = (struct nlmsgerr*)NLMSG_DATA(hdr);
+      if(answer -> error == 0){
+        TTCN_Logger::log( TTCN_DEBUG,"Operation was successful!");
+      } else {
+        close(fd);
+        return XFRM__Result(-1,strerror(-answer->error));
+      };
+    } else if(hdr -> nlmsg_type == 16){
+      //Allocate SPI answer
+      struct xfrm_userspi_info* data = (struct xfrm_userspi_info*)NLMSG_DATA(hdr);
+      *spi = (unsigned long)htonl(data->info.id.spi);
+    } else {
+      close(fd);
+      return XFRM__Result(-1, "Unexpected message from kernel! Message type: "+(char)hdr->nlmsg_type);
+    };
+  };
+  close(fd);
+  return XFRM__Result(0,"TCCIPsec XFRM: Success!"); 
+}
+
+XFRM__Result create_socket(void* memo, unsigned int size, unsigned long* spi){
+  int xfd;
+  struct sockaddr_nl address;
+
+  //Creating Netlink socket
+  xfd = socket(AF_NETLINK,SOCK_DGRAM,NETLINK_XFRM);
+  if(xfd == -1){
+    return XFRM__Result(-1,"TCCIPsec XFRM: Failed!");
+  };
+  TTCN_Logger::log( TTCN_DEBUG,"###### Netlink socket created.");
+
+  memset(&address,0,sizeof(address));
+  address.nl_family = AF_NETLINK;
+  if(bind(xfd,(struct sockaddr*)&address,sizeof(address)) == -1){
+    close(xfd);
+    return XFRM__Result(-1,"TCCIPsec XFRM: Failed to bind soscket");
+  };
+
+  TTCN_Logger::log( TTCN_DEBUG,"###### Sending socket to the kernel:");
+  return send(xfd, memo, size, spi);
+}
+
+void f_set_MessageHeader(void* memo, const int type, const unsigned int length){
+  struct nlmsghdr* hdr;
+   hdr = (struct nlmsghdr*)memo;
+
+  //Setting the message headers
+  hdr->nlmsg_len = NLMSG_LENGTH(length);
+  hdr->nlmsg_type = type;
+  hdr->nlmsg_flags = NLM_F_REQUEST|NLM_F_ACK;
+  hdr->nlmsg_seq = 1;
+  hdr->nlmsg_pid = 0;
+  return;
+}
+
+XFRM__Result f__XFRM__add__sa(const SAAddInfo& sa_info){
+  unsigned long spi = 0;
+  unsigned int enc_key_len = 0;
+  unsigned int auth_key_len = 0;
+  unsigned int payload_len;
+  int size;
+
+  TTCN_Logger::log( TTCN_DEBUG,"###### Adding new SAs to the database:");
+  payload_len = NLA_ALIGN(sizeof(struct xfrm_usersa_info));
+  //Calculating length of the encryption key
+  if(sa_info.ipsec__algos().enc().ispresent()) {
+   if(sa_info.ipsec__algos().enc()().key().get_selection() == IPSecKey::ALT_text){
+     enc_key_len = sa_info.ipsec__algos().enc()().key().text().lengthof();
+   } else {
+     enc_key_len = sa_info.ipsec__algos().enc()().key().hex().lengthof()/2;
+   };
+    payload_len += NLA_HDRLEN+NLA_ALIGN(sizeof(struct xfrm_algo)+enc_key_len);
+  };
+
+  //Calculating length of the authentication key 
+  if(sa_info.ipsec__algos().auth().ispresent()) {
+   if(sa_info.ipsec__algos().auth()().key().get_selection() == IPSecKey::ALT_text)auth_key_len = sa_info.ipsec__algos().auth()().key().text().lengthof();
+   else auth_key_len = sa_info.ipsec__algos().auth()().key().hex().lengthof()/2;
+    payload_len += NLA_HDRLEN+NLA_ALIGN(sizeof(struct xfrm_algo)+auth_key_len);
+  };  
+  if(sa_info.nat__t().ispresent()) {
+    payload_len += NLA_HDRLEN+NLA_ALIGN(sizeof(struct xfrm_encap_tmpl));
+  };
+ 
+  size = NLMSG_SPACE(payload_len);
+  Message msg = Message(size);
+  int message_type = XFRM_MSG_NEWSA;
+  if(sa_info.update().ispresent()){
+    if(sa_info.update()())message_type = XFRM_MSG_UPDSA;
+  };
+
+  f_set_MessageHeader(msg.memory,message_type,payload_len);
+  f_set_MessageBody_for_addSA(msg.memory, sa_info, enc_key_len, auth_key_len);
+
+  return create_socket(msg.memory, size, &spi);
+};
+
+
+XFRM__Result f__XFRM__delete__sa(const SADelInfo& sa_info){
+  unsigned long spi = 0;
+  unsigned int payload_len;
+  int size;
+  
+  TTCN_Logger::log( TTCN_DEBUG,"###### Deleting SA from the database:");
+  payload_len = NLA_ALIGN(sizeof(struct xfrm_usersa_id))
+               +NLA_HDRLEN+NLA_ALIGN(sizeof(xfrm_address_t));
+               
+  size = NLMSG_SPACE(payload_len);
+  Message msg = Message(size);
+  f_set_MessageHeader(msg.memory,XFRM_MSG_DELSA,payload_len);
+  f_set_MessageBody_for_deleteSA(msg.memory, sa_info);
+  
+  return create_socket(msg.memory, size, &spi);
+};
+
+XFRM__Result f__XFRM__flush__sa(){
+  unsigned long spi = 0;
+  const unsigned int payload_len = NLA_ALIGN(sizeof(struct xfrm_usersa_flush));
+  int size = NLMSG_SPACE(payload_len);
+  struct xfrm_usersa_flush* sa;
+  Message msg = Message(size);
+
+  TTCN_Logger::log( TTCN_DEBUG,"###### Flushing SA database");
+  f_set_MessageHeader(msg.memory,XFRM_MSG_FLUSHSA,payload_len);
+
+  sa = (struct xfrm_usersa_flush*)NLMSG_DATA(msg.memory);
+  memset(sa,0,sizeof(struct xfrm_usersa_flush));
+
+  return create_socket(msg.memory, size, &spi);
+};
+
+XFRM__Result f__XFRM__add__policy(const SPAddInfo& pol_info){
+  unsigned long spi = 0;
+  unsigned int payload_len;
+  int size;
+  int numberOfTmpls = pol_info.tmpl().size_of();
+
+  TTCN_Logger::log( TTCN_DEBUG,"###### Adding new policies to the database:");
+  payload_len = NLA_ALIGN(sizeof(struct xfrm_userpolicy_info))
+                   +(NLA_HDRLEN+NLA_ALIGN(sizeof(struct xfrm_user_tmpl)))*numberOfTmpls;
+  size = NLMSG_SPACE(payload_len);
+
+  Message msg = Message(size);
+  int message_type = XFRM_MSG_NEWPOLICY;
+  if(pol_info.update().ispresent()){
+    if(pol_info.update()())message_type = XFRM_MSG_UPDPOLICY;
+  };
+
+  f_set_MessageHeader(msg.memory,message_type,payload_len);
+  f_set_SP_add_info(msg.memory, pol_info);
+
+  return create_socket(msg.memory, size, &spi);
+};
+
+XFRM__Result f__XFRM__delete__policy(const SPDelInfo& pol_info){
+  unsigned long spi = 0;
+  unsigned int payload_len;
+  int size;
+
+  TTCN_Logger::log( TTCN_DEBUG,"###### Deleting policies from the database:");
+  payload_len = NLA_ALIGN(sizeof(struct xfrm_userpolicy_id));
+  size = NLMSG_SPACE(payload_len);
+  Message msg = Message(size);
+  
+  f_set_MessageHeader(msg.memory,XFRM_MSG_DELPOLICY,payload_len);
+  f_set_SP_delete_info(msg.memory, pol_info);
+
+  return create_socket(msg.memory, size, &spi);
+};
+
+XFRM__Result f__XFRM__flush__policy(){
+    unsigned long spi = 0;
+  const unsigned int payload_len = NLA_ALIGN(sizeof(struct xfrm_usersa_flush));
+  int size = NLMSG_SPACE(payload_len);
+  Message msg = Message(size);
+  TTCN_Logger::log( TTCN_DEBUG,"###### Flushing the policy database");
+  f_set_MessageHeader(msg.memory,XFRM_MSG_FLUSHPOLICY,payload_len);
+
+  return create_socket(msg.memory, size, &spi);
+};
+
+XFRM__Result f__XFRM__allocate__SPI(
+  const AllocSPI__Info& info,
+  INTEGER& spi
+){
+  unsigned int payload_len = NLA_ALIGN(sizeof(struct xfrm_userspi_info));
+  int size = NLMSG_SPACE(payload_len);
+  unsigned long spi_val = 0;
+
+  TTCN_Logger::log( TTCN_DEBUG,"###### Getting a free SPI from the kernel.");
+  Message msg = Message(size);
+  f_set_MessageHeader(msg.memory,XFRM_MSG_ALLOCSPI,payload_len);
+
+
+  struct xfrm_userspi_info* sa = (struct xfrm_userspi_info*)NLMSG_DATA(msg.memory);
+  memset(sa,0,sizeof(struct xfrm_usersa_info));
+   
+  //set destination address
+  int addr_family = f_set_IP_address(info.dst(), &sa->info.id.daddr);
+  if(addr_family >= 0){
+    sa->info.family = sa->info.sel.family = addr_family;
+  }; //else default value will be set: 0.0.0.0
+
+  //set source address
+  addr_family = f_set_IP_address(info.src(), &sa->info.saddr);
+   if(addr_family >= 0){
+    sa->info.family = sa->info.sel.family = addr_family;
+  }; //else default value will be set: 0.0.0.0
+   
+  sa->info.sel.prefixlen_d = sa->info.sel.prefixlen_s = 0;
+
+  //Setting default values for each parameter
+  //Some of the parameters are not configurable, but can be added later
+  sa->info.sel.ifindex = 0;
+  sa->info.sel.user = 0;
+  sa->info.id.spi = 0;
+  sa->info.id.proto = info.protocol();      
+  sa->info.mode = 0;
+
+  sa->info.curlft.bytes = 0;
+  sa->info.curlft.packets = 0;
+  sa->info.curlft.add_time = 0;
+  sa->info.curlft.use_time = 0;
+  sa->info.stats.replay_window = 0;
+  sa->info.stats.replay = 0;
+  sa->info.stats.integrity_failed = 0;
+
+  sa->info.seq = 0;
+  sa->info.reqid = 0;
+  sa->info.replay_window = sa->info.stats.replay_window;
+  sa->info.flags = 0;
+  sa->min = 0;
+  sa->max = 4294967294;
+
+  if(info.range().ispresent()){
+    sa->min = info.range()().min();
+    sa->min = info.range()().max();
+  };
+
+  XFRM__Result result = create_socket(msg.memory, size, &spi_val);
+  spi.set_long_long_val(spi_val);
+  return result;
+};
+
+} //namespace
diff --git a/src/TCCIPsec_XFRM.hh b/src/TCCIPsec_XFRM.hh
new file mode 100644
index 0000000000000000000000000000000000000000..0e8fbf8249315bcb55c6787c3f785f8b0bc21036
--- /dev/null
+++ b/src/TCCIPsec_XFRM.hh
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
+///////////////////////////////////////////////////////////////////////////////
+//
+//  File:               TCCIPsec_XFRM.hh
+//  Description:        TCC Useful Functions: IPsec XFRM Functions
+//  Rev:                R30A
+//  Prodnr:             CNL 113 472
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TCCIPsec_XFRM_Definitions.hh"
+#ifdef LINUX
+  #include <linux/xfrm.h>
+#else
+  #include <net/xfrm.h>
+#endif
+
+using namespace TCCIPsec__XFRM__Definitions;
+
+void f_set_MessageBody_for_addSA(void*,const SAAddInfo&,const unsigned int,const unsigned int);
+void f_set_MessageBody_for_deleteSA(void*,const SADelInfo&);
+
+void f_set_SP_add_info(void*,const SPAddInfo&);
+void f_set_SP_delete_info(void*,const SPDelInfo&);
+
+int f_set_IP_address(CHARSTRING, xfrm_address_t*);
+xfrm_lifetime_cfg f_set_IP_lifetime(Limits limits);
diff --git a/src/TCCIPsec_XFRM_Definitions.ttcn b/src/TCCIPsec_XFRM_Definitions.ttcn
new file mode 100644
index 0000000000000000000000000000000000000000..67bcb899c085bab9a15bf6858b9da18e77eebe8c
--- /dev/null
+++ b/src/TCCIPsec_XFRM_Definitions.ttcn
@@ -0,0 +1,578 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
+///////////////////////////////////////////////////////////////////////////////
+//
+//  File:               TCCIPsec_XFRM_Definitions.ttcn
+//  Description:        TCC Useful Functions: IPsec XFRM Functions
+//  Rev:                R30A
+//  Prodnr:             CNL 113 472
+//
+///////////////////////////////////////////////////////////////////////////////
+
+module TCCIPsec_XFRM_Definitions{
+  external function f_XFRM_add_sa(in SAAddInfo pl_sa_info) return XFRM_Result;
+  external function f_XFRM_delete_sa(in SADelInfo pl_sa_info) return XFRM_Result;
+  external function f_XFRM_flush_sa() return XFRM_Result;
+  external function f_XFRM_add_policy(in SPAddInfo pl_pol_info) return XFRM_Result;
+  external function f_XFRM_delete_policy(in SPDelInfo pl_pol_info) return XFRM_Result;
+  external function f_XFRM_flush_policy() return XFRM_Result;
+  external function f_XFRM_allocate_SPI(in AllocSPI_Info pl_AllocSPI_info, inout integer pl_spi) return XFRM_Result; 
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: NetworkAddress
+//
+//  Purpose:
+//    Defines a record for using IP addresses with port and prefix number.
+//
+//  Elements:
+//    ip_address     -  An IPv4 or IPv6 address (string).
+//                      Not valid address form can result an error in the database.
+//                      For example not inserting the new database entry.
+//
+//    port_number    -  An integer used to specify a given port for the policies.
+//    address_prefix -  An integer indivating the network prefix for the address.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type record NetworkAddress{
+  charstring  ip_address,
+  integer     port_number optional,
+  integer     address_prefix optional
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: TransportProtocol
+//
+//  Purpose:
+//    Defines an enumerated value for selecting the Transport Protocol.
+//    For default value, the ANY choice is used in the protocol.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type enumerated TransportProtocol{
+  ANY    (0),
+  ICMP   (1),  //IPPROTO_ICMP
+  TCP    (6),  //IPPROTO_TCP
+  UDP    (17), //IPPROTO_UDP
+  DCCP   (33), //IPPROTO_DCCP
+  GRE    (47), //IPPROTO_GRE
+  ICMPV6 (58), //IPPROTO_ICMPV6
+  SCTP   (132) //IPPROTO_SCTP
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: PolicyDirection
+//
+//  Purpose:
+//    Defines the direction of a policy used on the packets.
+//
+/////////////////////////////////////////////////////////////////////////////////
+type enumerated PolicyDirection{
+  IN  (0),  //XFRM_POLICY_IN
+  OUT (1),  //XFRM_POLICY_OUT
+  FWD (2)   //XFRM_POLICY_FWD
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: IPsecAlgorithms
+//
+//  Purpose:
+//    Defines the encryption and authentication methods used in the Security 
+//    Associations.
+//
+//  Elements:
+//    auth  -  Defines an authentication method and the key used.
+//    enc    -  Defines an encryption method and the key used.
+//
+//  Comment:
+//    Using Encryption without authentication is strongly discouraged, because
+//     it is insecure.
+/////////////////////////////////////////////////////////////////////////////////
+type record IPsecAlgorithms{
+  Authentication  auth optional,
+  Encryption      enc optional
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: IPSecProtocol
+//
+//  Purpose:
+//    Defines the IPSec protocol used.
+//
+//  Elements:
+//    ESP  -  Encapsulating Security Payloads: it provides origin authenticity, 
+//            integrity and confidentiality protection of packets.
+//    AH   -  Authentication Header: It guarantees connectionless integrity and data
+//            origin authentication of IP packets
+//    COMP -  IP Payload Compression: a low level compression protocol for IP datagrams
+//            Compression must be done before fragmenting or encrypting the packet.
+/////////////////////////////////////////////////////////////////////////////////
+type enumerated IPSecProtocol{
+  ESP(50),  //IPPROTO_ESP
+  AH(51),   //IPPROTO_AH
+  COMP(108) //IPPROTO_COMP
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: IPSecKey
+//
+//  Purpose:
+//    Defines a charstring or hexstring for the key used in ESP or AH.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type union IPSecKey{
+  charstring  text,
+  hexstring    hex
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: Authentication
+//
+//  Purpose:
+//    Defines the name of the authentication algorithm and the key used.
+//
+//  Elements:
+//    name - An enumerated value for selecting the algorithm
+//    key  - The used key for the authentication. It can be given in charstring
+//           or hexstring value.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type record Authentication{
+  AuthenticationAlgorithms name,
+  IPSecKey                 key
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: AuthenticationAlgorithms
+//
+//  Purpose:
+//    Defines an enumerated value for selecting the authentication alogrithm.
+//    
+//  Comment:
+//    The key lengths are next to each possible algorithm.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type enumerated AuthenticationAlgorithms{
+  NULL_AUTH    (0),
+  HMAC_MD5     (1),    //key length: 128 bits 
+  HMAC_SHA1    (2),    //key length: 160 bits 
+  HMAC_SHA256  (3),    //key length: 256 bits
+  HMAC_SHA384  (4),    //key length: 384 bits
+  HMAC_SHA512  (5),    //key length: 512 bits
+  HMAC_RMD160  (6)      //key length: 160 bits 
+};
+
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: Encryption
+//
+//  Purpose:
+//    Defines the name of the encryption algorithm and the key used.
+//
+//  Elements:
+//    name - An enumerated value for selecting the algorithm
+//    key  - The used key for the encryption. It can be given in charstring
+//           or hexstring value.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type record Encryption{
+  EncryptionAlgorithms name,
+  IPSecKey             key
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////
+//  Type: EncryptionAlgorithms
+//
+//  Purpose:
+//    Defines an enumerated value for selecting the encryption alogrithm.
+//    
+//  Comment:
+//    The key lengths are next to each possible algorithm.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type enumerated EncryptionAlgorithms{
+  NULL_ENCR    (0),
+  CBC_AES      (1),    //key length: 128 bits 
+  CBC_DES      (2),    //key length:   64 bits 
+  CBC_3DES     (3),    //key length: 192 bits  
+  CBC_CAST5    (4),    //key length: 40-128 bits
+  CBC_BLOWFISH (5),    //key length: 40-448 bits
+  CBC_SERPENT  (6),    //key length: 128-256 bits
+  CBC_CAMELLIA (7),    //key length: 128-256 bits
+  CBC_TWOFISH  (8)      //key length: 128-256 bits
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: Mode
+//
+//  Purpose:
+//    Defines an enumerated value for selecting the mode of the operation for the
+//    transform protocol..
+//
+//  Comment:
+//    BEET - Bound End-to-End Tunnel is for ESP only.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type enumerated Mode{
+  TRANSPORT (0),  //XFRM_MODE_TRANSPORT
+  TUNNEL    (1),  //XFRM_MODE_TUNNEL
+  BEET      (4)   //XFRM_MODE_BEET
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: Share
+//
+//  Purpose:
+//    Defines an enumerated value for selecting sharing mode.
+//
+//  Comment:
+//    Should be ANY. In the current version, not used by the kernel, but required 
+//    for forward compatibility..
+//
+///////////////////////////////////////////////////////////////////////////////////
+type enumerated Share{
+  ANY     (0),    //XFRM_SHARE_ANY: No limitations(default value)
+  SESSION (1),    //XFRM_SHARE_SESSION: For this session only
+  USER    (2),    //XFRM_SHARE_USER: For this user only
+  UNIQUE  (3)     //XFRM_SHARE_UNIQUE: Use once
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: Action
+//
+//  Purpose:
+//    Defines an enumerated value for allowing/blocking traffic
+//
+///////////////////////////////////////////////////////////////////////////////////
+type enumerated Action{
+  ALLOW  (0),  //XFRM_POLICY_ALLOW
+  BLOCK  (1)   //XFRM_POLICY_BLOCK
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: Level
+//
+//  Purpose:
+//    Defines an enumerated value for setting the level of the policy
+//
+//  Comment:
+//    use       - Indicates, that the policy should be used if there is an
+//                appropriate SA avaiable. (else the policy is bypassed)
+//    required  -  The policy has to be used.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type enumerated Level{
+  required (0),
+  use      (1)
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: Template
+//
+//  Purpose:
+//    Defines a record for the policy template. The behavior of the policy can be 
+//    described with the templates. For example, the use of AH or ESP can be set 
+//    via the templates.
+//
+//  Elements:
+//    ip_version - Specifies the IP version
+//    src        - Source address of the tunnel. Ignored in other cases.
+//    dst        - Destination of the tunnel. It may be zero for transport mode.
+//    spi        - Security Parameter Index, it is used to select the appropriate SA.
+//                 The default value of SPI can be zero.
+//    reqid      - Association between the policies and the SAs.(If a policy matches 
+//                 on a packet, then it will start searching for a matching SA based 
+//                 on the reqid value.)
+//    share      - Selects the share mode(Default value: ANY, probably not used by 
+//                 the kernel, but it is required for forward compatibility.)
+//    ipsec      - Defines the IPSec protocol used.
+//    mode       - Transform mode.
+//    level      - Sets the level of the policy.
+///////////////////////////////////////////////////////////////////////////////////
+type record Template{
+  NetworkAddress src optional,
+  NetworkAddress dst optional,
+  integer        spi,
+  integer        reqid optional,
+  Share          share optional,
+  IPSecProtocol  ipsec,
+  Mode           mode,
+  Level          level
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: Template_List
+//
+//  Purpose:
+//    Defines a list of Templates.
+//
+///////////////////////////////////////////////////////////////////////////////////
+type set of Template Template_List;
+
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: Limits
+//
+//  Purpose:
+//    With the help of th is record, time, packet and byte limits can be set for
+//    the policies and the SAs.
+//
+//  Comment:
+//    soft vs hard: If the soft limit expire, then rekeying is required. If the 
+//                  hard limit expires, the entry from the database will be deleted.
+//
+//  Elements:
+//    byte_limit          - Defines a limit based on the sent/recieved bytes
+//    packet_limit        - Defines a limit based on the sent/recieved packets
+//    add_expires_seconds - Defines a limit based on the time elapsed since insertion/update
+///////////////////////////////////////////////////////////////////////////////////
+type record Limits{
+  integer  soft_byte_limit optional,
+  integer  hard_byte_limit optional,
+  integer  soft_packet_limit optional,
+  integer  hard_packet_limit optional,
+  integer  soft_add_expires_seconds optional,
+  integer  hard_add_expires_seconds optional,
+  integer  soft_use_expires_seconds optional,
+  integer  hard_use_expires_seconds optional
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: Encap_type
+//
+//  Purpose:
+//    Encapsulates packets with protocol espinudp or espinudp-non-ike
+//
+//  Comment:
+//    It uses source port, destination port and original address.
+///////////////////////////////////////////////////////////////////////////////////
+type enumerated Encap_type{
+  ESPINUDP_NON_IKE  (1),
+  ESPINUDP          (2) //Default value should be this
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: NAT_T
+//
+//  Purpose:
+//    Enables the usage of Network Address Traversal for the IPsec tunnel
+//
+//  Elements:
+//    encap_type - Defines encapsulation protocol
+//    sport      - Source port --> "hole" in the wall
+//    dport      - Destination port --> "hole" in the wall
+//    oa         - Original Adress
+///////////////////////////////////////////////////////////////////////////////////
+type record NAT_T{
+  Encap_type  encap_type,   //Default value should be ESPINUDP
+  integer     sport,        //Default value should be 4500
+  integer     dport,        //Default value should be 4500
+  charstring  oa optional
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: SAAdditionalInfo
+//
+//  Purpose:
+//    Defines additional information regarding the Security Association creation.
+//    These are not mandatory parameters for creating a valid SA.
+//
+//  Elements:
+//    sel_src and sel_dst - Selector address that is used to identify if a packet
+//                          requires IPsec related actions.
+//    reqid               - Also serves as an identification between the SP and SA
+//    limits              - Lifetime limits for the Security Association
+///////////////////////////////////////////////////////////////////////////////////
+type record SAAdditionalInfo{
+  NetworkAddress    sel_src optional,
+  NetworkAddress    sel_dst optional,
+  integer           reqid optional,   //Policy<->SA connection, else selector
+  Limits            limits optional
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: SAAddInfo
+//
+//  Purpose:
+//    Defines the basic information for creating a Security Assoctiation.
+//
+//  Elements:
+//    update      - if set to true and the SA already exists, it will be updated/overwritten
+//                  if not exists, it will be created.
+//    protocol    - Defines the used transport protocol
+//    ipsec       - Defines the type of IPsec usage
+//    ipsec_agos  - Defines the algorithms and keys
+//    mode        - IPsec mode (tunneling or transport)
+//    spi         - Security Parameter Index
+//    src         - Source address
+//    dst         - Destination adress
+//    nat_t       - Enable NAT
+//    info        - Defines additional settings
+///////////////////////////////////////////////////////////////////////////////////
+type record SAAddInfo{
+  boolean           update optional,
+  TransportProtocol protocol,
+  IPSecProtocol     ipsec,
+  IPsecAlgorithms   ipsec_algos,
+  Mode              mode,
+  integer           spi,
+  NetworkAddress    src,
+  NetworkAddress    dst,
+  NAT_T              nat_t optional,  
+  SAAdditionalInfo  info optional
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: SADelInfo
+//
+//  Purpose:
+//    Defines the basic information toidentiy and remove a Security Assoctiation.
+//
+//  Elements:
+//    protocol    - Defines the used transport protocol
+//    spi         - Security Parameter Index
+//    src         - Source address
+//    dst         - Destination adress
+///////////////////////////////////////////////////////////////////////////////////
+type record SADelInfo{
+  IPSecProtocol     proto,
+  integer           spi,
+  NetworkAddress    src,
+  NetworkAddress    dst
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: SPAdditionalInfo
+//
+//  Purpose:
+//    Defines additional information regarding the Security Policy creation.
+//    These are not mandatory parameters for creating a valid SP.
+//
+//  Elements:
+//    share           - Defines the scope of the policy
+//    priority        - Enables prioritization of SPs
+//    policy_action   - Policy rule (ALLOW or BLOCK)
+//    index           - Used for identification, similar to the selector
+//    interface_index - Enables the usage of an SP only for a specific interface
+//    limits          - Lifetime limits for the Security Policy  
+///////////////////////////////////////////////////////////////////////////////////
+type record SPAdditionalInfo{
+  Share    share optional,
+  integer priority optional,
+  Action  policy_action optional,
+  integer  index optional,
+  integer  interface_index optional,
+  Limits  limits optional
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: SPAddInfo
+//
+//  Purpose:
+//    Defines the basic information for creating a Security Policy.
+//
+//  Elements:
+//    update    - if set to true and the SP already exists, it will be updated/overwritten
+//                if not exists, it will be created.
+//    protocol  - Defines the used transport protocol
+//    src       - Source address
+//    dst       - Destination adress
+//    dir       - Direction of the traffic
+//    tmpl      - Defines Templates for the SP that is used for idetification
+//    info      - Defines additional settings
+///////////////////////////////////////////////////////////////////////////////////
+type record SPAddInfo{
+  boolean           update optional,
+  TransportProtocol protocol,
+  NetworkAddress    src,
+  NetworkAddress    dst,
+  PolicyDirection   dir,
+  Template_List      tmpl,
+  SPAdditionalInfo  info optional
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: SPDelInfo
+//
+//  Purpose:
+//    Defines the basic information for identifying and removing a Security Policy.
+//
+//  Elements:
+//    dir       - Direction of the traffic
+//    protocol  - Defines the used transport protocol
+//    src       - Source address
+//    dst       - Destination adress
+///////////////////////////////////////////////////////////////////////////////////
+type record SPDelInfo{
+  PolicyDirection   dir,
+  TransportProtocol protocol,
+  NetworkAddress    src,
+  NetworkAddress    dst
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: SPI_Range
+//
+//  Purpose:
+//    Minimum and maximum value for SPI
+///////////////////////////////////////////////////////////////////////////////////
+type record SPI_Range{
+  integer min,
+  integer max
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: AllocSPI_Info
+//
+//  Purpose:
+//    Defines the basic information for allocating an SPI value.
+//
+//  Elements:
+//    src       - Source address
+//    dst       - Destination adress
+//    protocol  - IPsec protocol
+//    range     - Range of the SPI
+///////////////////////////////////////////////////////////////////////////////////
+type record AllocSPI_Info{
+  charstring    src,
+  charstring    dst,
+  IPSecProtocol protocol,
+  SPI_Range     range optional
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//  Type: XFRM_Result
+//
+//  Purpose:
+//    Serves as a return value for the TTCN-3 functions. It contains general result
+//    and in case of an error, some description on the error.
+//
+//  Elements:
+//    result  - If the execution is successful,the value is 0.
+//    msg     - If error occurs before reaching the kernel or the error is in the
+//              communications with the kernel, then this contains information on it.
+//              If the reponse is negative, then it contains the message from the kernel.
+///////////////////////////////////////////////////////////////////////////////////
+type record XFRM_Result{
+  integer result,
+  charstring msg
+}
+  
+}
diff --git a/src/TCCIPsec_XFRM_SA.cc b/src/TCCIPsec_XFRM_SA.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0f4a3dc77808d0ea910b4dcd942d1869a53f3650
--- /dev/null
+++ b/src/TCCIPsec_XFRM_SA.cc
@@ -0,0 +1,324 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
+///////////////////////////////////////////////////////////////////////////////
+//
+//  File:               TCCIPsec_XFRM_SA.cc
+//  Description:        TCC Useful Functions: IPsec XFRM Functions
+//  Rev:                R30A
+//  Prodnr:             CNL 113 472
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <asm/types.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <time.h>
+#include <signal.h>
+
+#ifdef LINUX
+  #include <linux/netlink.h>
+#else
+  #include <net/netlink.h>
+#endif
+
+#include "TCCIPsec_XFRM_Definitions.hh"
+#include "TCCIPsec_XFRM.hh"
+#include "Logger.hh"
+
+using namespace TCCIPsec__XFRM__Definitions;
+
+//Sets the IP address to the addr parameter and returns the address family
+int f_set_IP_address(CHARSTRING address, xfrm_address_t* addr){
+  int temp = inet_pton(AF_INET,address,(void*)&addr->a4);
+  if(temp > 0){
+    return AF_INET;
+  }else{
+    temp = inet_pton(AF_INET6,address,(void*)&addr->a6);
+    if(temp > 0){
+      return AF_INET6;
+    }else{
+      TTCN_Logger::log( TTCN_DEBUG,"######   dst: "+address+" is not a well-formed IP address!");
+      return -1;
+    };
+  };
+}
+
+xfrm_lifetime_cfg f_set_IP_lifetime(Limits limits){
+  //Set default values
+  xfrm_lifetime_cfg lft;
+  lft.soft_byte_limit = XFRM_INF;
+  lft.hard_byte_limit = XFRM_INF;
+  lft.soft_packet_limit = XFRM_INF;
+  lft.hard_packet_limit = XFRM_INF;
+  lft.soft_add_expires_seconds = 0;
+  lft.hard_add_expires_seconds = 0;
+  lft.soft_use_expires_seconds = 0;
+  lft.hard_use_expires_seconds = 0;
+
+  if(limits.soft__byte__limit().ispresent()){
+    lft.soft_byte_limit = limits.soft__byte__limit()();
+  };
+   if(limits.hard__byte__limit().ispresent()){
+     lft.hard_byte_limit = limits.hard__byte__limit()();
+  };
+  if(limits.soft__packet__limit().ispresent()){
+    lft.soft_packet_limit = limits.soft__packet__limit()();
+  };
+  if(limits.hard__packet__limit().ispresent()){
+    lft.hard_packet_limit = limits.hard__packet__limit()();
+  };
+  if(limits.soft__add__expires__seconds().ispresent()){
+    lft.soft_add_expires_seconds = limits.soft__add__expires__seconds()();
+  };
+  if(limits.hard__add__expires__seconds().ispresent()){
+    lft.hard_add_expires_seconds = limits.hard__add__expires__seconds()();
+  };
+  if(limits.soft__use__expires__seconds().ispresent()){
+    lft.soft_use_expires_seconds = limits.soft__use__expires__seconds()();
+  };
+  if(limits.hard__use__expires__seconds().ispresent()){
+    lft.hard_use_expires_seconds = limits.hard__use__expires__seconds()();
+  };
+  
+  return lft;
+}
+
+void f_process_additionalInfo(
+  xfrm_usersa_info* sa,
+  const SAAdditionalInfo& info
+){
+  if(info.sel__src().ispresent()){
+    f_set_IP_address(info.sel__src()().ip__address(), &sa->sel.saddr);
+    if(info.sel__src()().address__prefix().ispresent())sa->sel.prefixlen_s = info.sel__src()().address__prefix()();
+    if(info.sel__src()().port__number().ispresent()){
+      sa->sel.sport = htons(info.sel__src()().port__number()());
+      sa->sel.sport_mask = 0xffff;
+    };
+  };
+  
+  if(info.sel__dst().ispresent()){
+    f_set_IP_address(info.sel__dst()().ip__address(), &sa->sel.daddr);
+    if(info.sel__dst()().address__prefix().ispresent())sa->sel.prefixlen_d = info.sel__dst()().address__prefix()();
+    if(info.sel__dst()().port__number().ispresent()){
+      sa->sel.dport = htons(info.sel__dst()().port__number()());
+      sa->sel.dport_mask = 0xffff;
+    };
+  };
+
+  if(info.reqid().ispresent()){ sa->reqid  =  info.reqid()().get_long_long_val(); };
+  if(info.limits().ispresent()){
+    sa->lft = f_set_IP_lifetime(info.limits()());
+  };
+  return;
+}
+
+void f_set_encryptionInfo(
+  xfrm_algo* alg,
+  const Encryption& info,
+  int enc_key_len
+){
+  bool not_null  =  true;
+  switch(info.name()){
+    case EncryptionAlgorithms::NULL__ENCR:     {strcpy(alg->alg_name,"ecb(cipher_null)");alg->alg_key_len = 0;memcpy(alg->alg_key,"",0);not_null = false;break;}
+    case EncryptionAlgorithms::CBC__AES:       {strcpy(alg->alg_name,"cbc(aes)");break;}
+    case EncryptionAlgorithms::CBC__DES:       {strcpy(alg->alg_name,"cbc(des)");break;}
+    case EncryptionAlgorithms::CBC__3DES:     {strcpy(alg->alg_name,"cbc(des3_ede)");break;}
+    case EncryptionAlgorithms::CBC__CAST5:     {strcpy(alg->alg_name,"cbc(cast5)");break;}
+    case EncryptionAlgorithms::CBC__BLOWFISH: {strcpy(alg->alg_name,"cbc(blowfish)");break;}
+    case EncryptionAlgorithms::CBC__SERPENT:   {strcpy(alg->alg_name,"cbc(serpent)");break;}
+    case EncryptionAlgorithms::CBC__CAMELLIA: {strcpy(alg->alg_name,"cbc(camellia)");break;}
+    case EncryptionAlgorithms::CBC__TWOFISH:   {strcpy(alg->alg_name,"cbc(twofish)");break;}
+    default: {
+      strcpy(alg->alg_name,"ecb(cipher_null)");
+      alg -> alg_key_len = 0;
+      memcpy(alg->alg_key,"",0);
+      not_null = false;
+    }
+  };
+      
+  if(not_null){
+    alg->alg_key_len = enc_key_len*8;
+    if(info.key().get_selection() == IPSecKey::ALT_text){
+      memcpy(alg->alg_key,info.key().text(),enc_key_len);
+    } else {
+      memcpy(alg->alg_key,(const char*)(const unsigned char*)hex2oct(info.key().hex()),enc_key_len);
+    };
+  };
+  return;
+}
+
+void f_set_authenticationInfo(
+  xfrm_algo* alg,
+  const Authentication& info,
+  int auth_key_len
+){
+  bool not_null  =  true;
+  switch(info.name()){
+    case AuthenticationAlgorithms::NULL__AUTH:     {strcpy(alg->alg_name,"digest_null");alg->alg_key_len = 0;memcpy(alg->alg_key,"",0);not_null = false;break;}
+    case AuthenticationAlgorithms::HMAC__MD5:      {strcpy(alg->alg_name,"hmac(md5)");break;}
+    case AuthenticationAlgorithms::HMAC__SHA1:    {strcpy(alg->alg_name,"hmac(sha1)");break;}
+    case AuthenticationAlgorithms::HMAC__SHA256:  {strcpy(alg->alg_name,"hmac(sha256)");break;}
+    case AuthenticationAlgorithms::HMAC__SHA384:  {strcpy(alg->alg_name,"hmac(sha384)");break;}
+    case AuthenticationAlgorithms::HMAC__SHA512:   {strcpy(alg->alg_name,"hmac(sha512)");break;}
+    case AuthenticationAlgorithms::HMAC__RMD160:  {strcpy(alg->alg_name,"hmac(rmd160)");break;}
+    default: {
+      strcpy(alg->alg_name,"ecb(cipher_null)");
+      alg -> alg_key_len = 0;
+      memcpy(alg->alg_key,"",0);
+      not_null = false;
+    }
+  };
+  
+  if(not_null){
+    alg->alg_key_len = auth_key_len*8;
+    if(info.key().get_selection() == IPSecKey::ALT_text){
+      memcpy(alg->alg_key,info.key().text(),auth_key_len);
+    } else {
+      memcpy(alg->alg_key,(const char*)(const unsigned char*)hex2oct(info.key().hex()),auth_key_len);
+    };
+  };
+  return;
+}
+
+void f_set_MessageBody_for_addSA(
+  void* memo,
+  const SAAddInfo& sa_info,
+  const unsigned int enc_key_len,
+  const unsigned int auth_key_len
+){
+  struct xfrm_usersa_info* sa;
+  struct xfrm_algo* alg;
+  struct xfrm_encap_tmpl* nat;
+  struct nlattr* ahdr = NULL;
+  bool multiple_attr = false;
+
+   sa = (struct xfrm_usersa_info*)NLMSG_DATA(memo);
+   memset(sa,0,sizeof(struct xfrm_usersa_info));
+   
+   //set destination address
+   int addr_family = f_set_IP_address(sa_info.dst().ip__address(), &sa->id.daddr);
+   if(addr_family >= 0){
+    sa->family = sa->sel.family = addr_family;
+  }; //else default value will be set: 0.0.0.0
+
+  //set source address
+  addr_family = f_set_IP_address(sa_info.src().ip__address(), &sa->saddr);
+   if(addr_family >= 0){
+    sa->family = sa->sel.family = addr_family;
+  }; //else default value will be set: 0.0.0.0
+   
+  sa->sel.prefixlen_d = sa->sel.prefixlen_s = 0;
+  
+  if(sa_info.protocol() != TransportProtocol::ANY){
+    sa->sel.proto = sa_info.protocol();
+  } else {
+    //in case of ANY no value should be defined
+  }
+
+  //Setting default values for each parameter
+  //Some of the parameters are not configurable, but can be added later
+  sa->sel.ifindex = 0;
+  sa->sel.user = 0;
+  sa->id.spi = htonl(sa_info.spi().get_long_long_val());
+  sa->id.proto = sa_info.ipsec();      
+  sa->mode = sa_info.mode();
+
+  sa->curlft.bytes = 0;
+  sa->curlft.packets = 0;
+  sa->curlft.add_time = 0;
+  sa->curlft.use_time = 0;
+  sa->stats.replay_window = 0;
+  sa->stats.replay = 0;
+  sa->stats.integrity_failed = 0;
+
+  sa->seq = 0;
+  sa->reqid = 0;
+  sa->replay_window = sa->stats.replay_window;
+  sa->flags = 0;
+    
+  if(sa_info.info().ispresent()){
+    f_process_additionalInfo(sa, sa_info.info()());
+  };
+   
+  if(sa_info.ipsec__algos().enc().ispresent()){
+    TTCN_Logger::log( TTCN_DEBUG,"######   Encryption enabled.");
+    ahdr = (struct nlattr*)((char*)sa+NLA_ALIGN(sizeof(*sa)));
+    ahdr->nla_len = NLA_HDRLEN+sizeof(struct xfrm_algo)+enc_key_len;
+    ahdr->nla_type = XFRMA_ALG_CRYPT;
+    alg = (struct xfrm_algo*)((char*)ahdr+NLA_HDRLEN);
+
+    f_set_encryptionInfo(alg, sa_info.ipsec__algos().enc()(),enc_key_len);
+    multiple_attr = true;
+  };
+   
+   if(sa_info.ipsec__algos().auth().ispresent()){
+    TTCN_Logger::log( TTCN_DEBUG,"######   Authentication enabled.");
+     if(multiple_attr){ahdr = (struct nlattr*)((char*)ahdr+NLA_ALIGN(ahdr->nla_len));}
+    else {ahdr = (struct nlattr*)((char*)sa+NLA_ALIGN(sizeof(*sa)));};
+    ahdr->nla_len = NLA_HDRLEN+sizeof(struct xfrm_algo)+auth_key_len;
+    ahdr->nla_type = XFRMA_ALG_AUTH;
+    alg = (struct xfrm_algo*)((char*)ahdr+NLA_HDRLEN);
+
+    f_set_authenticationInfo(alg, sa_info.ipsec__algos().auth()(),auth_key_len);
+    multiple_attr  =  true;  
+   };
+
+  if(sa_info.nat__t().ispresent()){
+    TTCN_Logger::log( TTCN_DEBUG,"######   NAT traversal enabled.");
+    if(multiple_attr){ahdr = (struct nlattr*)((char*)ahdr+NLA_ALIGN(ahdr->nla_len));}
+    else {ahdr = (struct nlattr*)((char*)sa+NLA_ALIGN(sizeof(*sa)));};
+    ahdr->nla_len = NLA_HDRLEN+sizeof(*nat);
+    ahdr->nla_type = XFRMA_ENCAP;
+    nat = (struct xfrm_encap_tmpl*)((char*)ahdr+NLA_HDRLEN);
+    
+    nat->encap_type = sa_info.nat__t()().encap__type(),
+    nat->encap_sport = htons(sa_info.nat__t()().sport());
+    nat->encap_dport = htons(sa_info.nat__t()().dport());
+    
+    if(sa_info.nat__t()().oa().ispresent()){
+      addr_family = f_set_IP_address(sa_info.nat__t()().oa()(), &nat->encap_oa);
+    };
+  };
+
+  return;
+}
+
+void f_set_MessageBody_for_deleteSA(
+  void* memo,
+  const SADelInfo& sa_info
+){
+  struct xfrm_usersa_id* sa;
+  xfrm_address_t* src;
+  struct nlattr* ahdr;
+  
+  sa = (struct xfrm_usersa_id*)NLMSG_DATA(memo);
+  memset(sa,0,sizeof(struct xfrm_usersa_id));
+
+  int addr_family = f_set_IP_address(sa_info.dst().ip__address(), &sa->daddr);
+   if(addr_family >= 0){
+    sa->family = addr_family;
+  }; //else default value will be set: 0.0.0.0
+
+  sa->spi = htonl(sa_info.spi().get_long_long_val());
+
+  sa->proto = sa_info.proto();
+
+  ahdr = (struct nlattr*)((char*)sa+NLA_ALIGN(sizeof(*sa)));
+  ahdr->nla_len = NLA_HDRLEN+sizeof(*src);
+  ahdr->nla_type = XFRMA_SRCADDR;
+  src = (xfrm_address_t*)((char*)ahdr+NLA_HDRLEN);
+    
+  addr_family = f_set_IP_address(sa_info.src().ip__address(), src);
+
+  return;
+}
diff --git a/src/TCCIPsec_XFRM_SP.cc b/src/TCCIPsec_XFRM_SP.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b5597d242590c841501bac61ffbd6c7a6a095ade
--- /dev/null
+++ b/src/TCCIPsec_XFRM_SP.cc
@@ -0,0 +1,264 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
+///////////////////////////////////////////////////////////////////////////////
+//
+//  File:               TCCIPsec_XFRM_SP.cc
+//  Description:        TCC Useful Functions: IPsec XFRM Functions
+//  Rev:                R30A
+//  Prodnr:             CNL 113 472
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <asm/types.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <time.h>
+#include <signal.h>
+
+#ifdef LINUX
+  #include <linux/netlink.h>
+#else
+  #include <net/netlink.h>
+#endif
+
+#include "TCCIPsec_XFRM_Definitions.hh"
+#include "TCCIPsec_XFRM.hh"
+#include "Logger.hh"
+
+using namespace TCCIPsec__XFRM__Definitions;
+
+void f_process_additionalInfo(
+  xfrm_userpolicy_info* pol,
+  const SPAdditionalInfo& info
+){
+  if(info.share().ispresent()){pol->share = info.share()();};
+  if(info.priority().ispresent()){pol->priority = info.priority()();};
+  if(info.policy__action().ispresent()){pol->action = info.policy__action()();};
+  if(info.index().ispresent()){pol->index = info.index()();};
+  if(info.interface__index().ispresent()){pol->sel.ifindex = info.interface__index()();};
+
+  if(info.limits().ispresent()){
+    Limits limits = info.limits();
+    if(limits.soft__byte__limit().ispresent()){pol->lft.soft_byte_limit = limits.soft__byte__limit()();};
+    if(limits.hard__byte__limit().ispresent()){pol->lft.hard_byte_limit = limits.hard__byte__limit()();};
+    if(limits.soft__packet__limit().ispresent()){pol->lft.soft_packet_limit = limits.soft__packet__limit()();};
+    if(limits.hard__packet__limit().ispresent()){pol->lft.hard_packet_limit = limits.hard__packet__limit()();};
+    if(limits.soft__add__expires__seconds().ispresent()){pol->lft.soft_add_expires_seconds = limits.soft__add__expires__seconds()();};
+    if(limits.hard__add__expires__seconds().ispresent()){pol->lft.hard_add_expires_seconds = limits.hard__add__expires__seconds()();};
+  };
+
+  return;
+}
+
+void f_add_template(
+  xfrm_user_tmpl* xTmpl,
+  const Template tmpl,
+  int share,
+  bool ipv4
+){
+  if(tmpl.dst().ispresent()){
+    f_set_IP_address(tmpl.dst()().ip__address(), &xTmpl->id.daddr);
+  }else{
+    if(ipv4){
+      inet_pton(AF_INET,"0.0.0.0",(void*)&xTmpl->id.daddr.a4);
+    }else{
+      inet_pton(AF_INET6,"00:00:00:00:00:00:00:00",(void*)&xTmpl->id.daddr.a6);
+    };
+  };
+
+  if(tmpl.src().ispresent()){
+    f_set_IP_address(tmpl.src()().ip__address(), &xTmpl->saddr);
+  }else{
+    if(ipv4){
+      inet_pton(AF_INET,"0.0.0.0",(void*)&xTmpl->saddr.a4);
+    }else{
+      inet_pton(AF_INET6,"00:00:00:00:00:00:00:00",(void*)&xTmpl->saddr.a6);
+    };
+  };
+
+   xTmpl->id.spi = htonl(tmpl.spi().get_long_long_val());
+   xTmpl->id.proto = tmpl.ipsec();
+
+   if(ipv4)xTmpl->family = AF_INET;
+  else xTmpl->family = AF_INET6;
+      
+  if(tmpl.reqid().ispresent())xTmpl->reqid  =  tmpl.reqid()().get_long_long_val();
+  else xTmpl->reqid = 0;  //0:require else:unique
+
+   xTmpl->mode = tmpl.mode();
+
+   if(tmpl.share().ispresent()){
+     xTmpl->share = tmpl.share()();
+   } else xTmpl->share = share;
+
+   xTmpl->optional = 0;
+   switch(tmpl.level()){
+     case Level::use:{xTmpl->optional = 1;break;} 
+     default:        {xTmpl->optional = 0;}      //Level -- 0:required 1:use
+   };
+  
+   xTmpl->aalgos = (~(__u32)0);
+   xTmpl->ealgos = (~(__u32)0);
+   xTmpl->calgos = (~(__u32)0);
+  return;
+}
+
+void f_set_SP_add_info(
+  void* memo,
+  const SPAddInfo& pol_info
+){
+  struct xfrm_userpolicy_info* pol;
+  struct xfrm_user_tmpl* tmpl = NULL;
+  struct nlattr* ahdr;
+  bool ipv4 = true;
+  int numberOfTmpls = pol_info.tmpl().size_of();
+
+  pol = (struct xfrm_userpolicy_info*)NLMSG_DATA(memo);
+  memset(pol,0,sizeof(struct xfrm_userpolicy_info));
+  
+  int addr_family = f_set_IP_address(pol_info.dst().ip__address(), &pol->sel.daddr);
+   if(addr_family >= 0){
+    pol->sel.family = addr_family;
+    if(addr_family == AF_INET){
+      pol->sel.prefixlen_d = 32;
+      ipv4 = true;
+    } else {
+      pol->sel.prefixlen_d = 128;
+      ipv4 = false;
+    };
+  }; //else default value will be set: 0.0.0.0
+
+  addr_family = f_set_IP_address(pol_info.src().ip__address(), &pol->sel.saddr);
+   if(addr_family >= 0){
+    pol->sel.family = addr_family;
+    if(addr_family == AF_INET){
+      pol->sel.prefixlen_s = 32;
+    } else {
+      pol->sel.prefixlen_s = 128;
+    };
+  }; //else default value will be set: 0.0.0.0
+ 
+  if(pol_info.dst().address__prefix().ispresent()){pol->sel.prefixlen_d = pol_info.dst().address__prefix()();};
+   if(pol_info.src().address__prefix().ispresent()){pol->sel.prefixlen_s = pol_info.src().address__prefix()();};
+   if(pol_info.dst().port__number().ispresent()){
+     pol->sel.dport = htons(pol_info.dst().port__number()());
+     pol->sel.dport_mask = 0xffff;
+   };
+   if(pol_info.src().port__number().ispresent()){
+     pol->sel.sport = htons(pol_info.src().port__number()());
+     pol->sel.sport_mask = 0xffff;
+   };
+ 
+   pol->sel.ifindex = 0;
+   pol->sel.user = 0;
+ 
+  if(pol_info.protocol() != TransportProtocol::ANY){
+    pol->sel.proto = pol_info.protocol();
+  } else {
+    //in case of ANY, no value should be defined
+  }
+
+  //Setting default lifetime values
+  pol->lft.soft_byte_limit = XFRM_INF;
+   pol->lft.hard_byte_limit = XFRM_INF;
+   pol->lft.soft_packet_limit = XFRM_INF;
+   pol->lft.hard_packet_limit = XFRM_INF;
+   pol->lft.soft_add_expires_seconds = 0;
+   pol->lft.hard_add_expires_seconds = 0;
+   pol->lft.soft_use_expires_seconds = 0;
+   pol->lft.hard_use_expires_seconds = 0;
+
+  pol->curlft.bytes = 0;
+   pol->curlft.packets = 0;
+   pol->curlft.add_time = 0;
+   pol->curlft.use_time = 0;
+
+   pol->index = 0;
+
+   pol->share = XFRM_SHARE_ANY;
+   pol->priority = 0;
+  pol->action = XFRM_POLICY_ALLOW;
+   pol->flags = 0;
+
+   pol->dir  =  pol_info.dir();
+
+  if(pol_info.info().ispresent()){
+    f_process_additionalInfo(pol, pol_info.info()());
+  };
+    
+  Template__List list = pol_info.tmpl();
+  
+  ahdr = (struct nlattr*)((char*)pol+NLA_ALIGN(sizeof(*pol)));
+  ahdr->nla_len = NLA_HDRLEN+sizeof(*tmpl)*numberOfTmpls;
+   ahdr->nla_type = XFRMA_TMPL;
+   
+  for(int i = 0;i<numberOfTmpls;i++){
+    TTCN_Logger::log( TTCN_DEBUG,"######   %d. template:",i+1);
+    if(i>0){
+       tmpl = (struct xfrm_user_tmpl*)((char*)tmpl+NLA_ALIGN(sizeof(*tmpl)));
+    } else {
+       tmpl = (struct xfrm_user_tmpl*)((char*)ahdr+NLA_HDRLEN);
+    };  
+
+    f_add_template(tmpl,list[i],pol->share,ipv4);
+  };
+   return;
+}
+
+void f_set_SP_delete_info(
+  void* memo,
+  const SPDelInfo& pol_info
+){
+  struct xfrm_userpolicy_id* pol;
+  int temp;
+
+  pol = (struct xfrm_userpolicy_id*)NLMSG_DATA(memo);
+  memset(pol,0,sizeof(struct xfrm_userpolicy_id));
+
+  int addr_family = f_set_IP_address(pol_info.dst().ip__address(), &pol->sel.daddr);
+   if(addr_family >= 0){
+    pol->sel.family = addr_family;
+    if(addr_family == AF_INET){
+      pol->sel.prefixlen_d = 32;
+    } else {
+      pol->sel.prefixlen_d = 128;
+    };
+  }; //else default value will be set: 0.0.0.0
+
+    
+  temp = inet_pton(AF_INET,pol_info.src().ip__address(),(void*)&pol->sel.saddr.a4);
+  if(temp > 0){
+    pol->sel.family = AF_INET;
+    pol->sel.prefixlen_s = 32;
+  }else{
+    temp = inet_pton(AF_INET6,pol_info.src().ip__address(),(void*)&pol->sel.saddr.a6);
+    if(temp > 0){
+      pol->sel.family = AF_INET6;
+      pol->sel.prefixlen_s = 128;
+    }else{
+      TTCN_Logger::log( TTCN_DEBUG,"######   src: "+pol_info.dst().ip__address()+" is not a well-formed IP address!");
+    };
+  };
+
+  if(pol_info.dst().address__prefix().ispresent()){pol->sel.prefixlen_d = pol_info.dst().address__prefix()();};
+   if(pol_info.src().address__prefix().ispresent()){pol->sel.prefixlen_s = pol_info.src().address__prefix()();};
+
+  if(pol_info.dst().port__number().ispresent())pol->sel.dport = htons(pol_info.dst().port__number()());
+  if(pol_info.src().port__number().ispresent())pol->sel.sport = htons(pol_info.src().port__number()());
+  pol->sel.dport_mask = pol->sel.sport_mask = 0xffff;
+ 
+  pol->sel.proto = pol_info.protocol();
+
+  pol->dir = pol_info.dir();
+}
+
diff --git a/src/TCCInterface.cc b/src/TCCInterface.cc
index 14c57f3cfaf2713e108f36f0390dc0d94185c8c0..5d3d9157cbd01213e04f0cc06b2b0a0ed333850c 100644
--- a/src/TCCInterface.cc
+++ b/src/TCCInterface.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2012                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCInterface.cc
 //  Description:        TCC Useful Functions: Interface Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2012-10-18
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCInterface_Functions.ttcn b/src/TCCInterface_Functions.ttcn
index 3243f4f16de24623b11777761685110f9bde9f2a..1d3c0a318a41ca370bb8ac51367d420a8a58f550 100644
--- a/src/TCCInterface_Functions.ttcn
+++ b/src/TCCInterface_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2016                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCInterface_Functions.ttcn
 //  Description:        TCC Useful Functions: Interface Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2016-06-06
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCInterface_ip.h b/src/TCCInterface_ip.h
index c1a35a0f85a74a4ae6cf2cef26348a926d718bbd..5eaee6d095c2956ac00185048408b304bf9007bd 100644
--- a/src/TCCInterface_ip.h
+++ b/src/TCCInterface_ip.h
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2009                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCInterface_ip.h
 //  Description:        TCC Useful Functions: Interface Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2009-02-02
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -277,7 +274,9 @@ static int dnet_pton1(const char *src, struct dn_naddr *dna)
 	if ((pos == 0) || (node > 1023))
 		return 0;
 	dna->a_len = 2;
-	*(u_int16_t *)dna->a_addr = dn_htons((area << 10) | node);
+	u_int16_t ui16 = dn_htons((area << 10) | node);
+	dna->a_addr[0] = ui16;
+	dna->a_addr[1] = ui16 >> 8;
 
 	return 1;
 }
diff --git a/src/TCCMaths.cc b/src/TCCMaths.cc
index 4d0aaad541ee6c169cc309205bf9a2cac8168ff6..28afd8c57fc7dc95c0a6b82d97445031e7c8aeb6 100644
--- a/src/TCCMaths.cc
+++ b/src/TCCMaths.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2007                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCMaths.cc
 //  Description:        TCC Useful Functions: Maths Functions.
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2007-03-07
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -25,6 +22,35 @@
 using namespace TCCMaths__GenericTypes;
 namespace TCCMaths__Functions {
 
+///////////////////////////////////////////////////////////////////////////////
+//template for count min or max value of list
+///////////////////////////////////////////////////////////////////////////////
+template<typename T_list>
+T_list f_minmax(const T_list& list, bool min)
+{
+  T_list toret;
+  toret[1] = -1;
+  toret[0] = 0;
+
+  int len;
+  if(!list.is_bound() or ((len = list.size_of()) == 0))
+  {
+    return toret;
+  }
+
+  toret[0] = list[0];
+  toret[1] = 0;
+
+  for(int i=1 ; i<len ; ++i)
+  {
+    if(min?toret[0] > list[i]:toret[0] < list[i])
+    {
+      toret[0] = list[i];
+      toret[1] = i;
+    }
+  }
+  return toret;
+}
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f__maxIL
 //
@@ -47,22 +73,7 @@ namespace TCCMaths__Functions {
 ///////////////////////////////////////////////////////////////////////////////
 IntegerList f__maxIL(const IntegerList& ilist)
 {
-    IntegerList toret;
-
-    toret[0] = 0;
-    toret[1] = -1;
-    if(!ilist.is_bound()) return toret;
-    int len = ilist.size_of();
-
-    int m = - 0xffff;
-    for(int i=0;i<len;i++)
-        if(ilist[i]>m)
-        {
-            m = ilist[i];
-            toret[1] = i;
-        }
-    toret[0] = m;
-    return toret;
+  return f_minmax(ilist, false);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -88,20 +99,7 @@ IntegerList f__maxIL(const IntegerList& ilist)
 ///////////////////////////////////////////////////////////////////////////////
 IntegerList f__minIL(const IntegerList& ilist)
 {
-    IntegerList toret;
-    toret[0] = 0;
-    toret[1] = -1;
-    if(!ilist.is_bound()) return toret;
-    int len = ilist.size_of();
-    int m = 0xffff;
-    for(int i=0;i<len;i++)
-        if(ilist[i]<m)
-        {
-            m = ilist[i];
-            toret[1] = i;
-        }
-    toret[0] = m;
-    return toret;
+  return f_minmax(ilist, true);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -127,21 +125,7 @@ IntegerList f__minIL(const IntegerList& ilist)
 ///////////////////////////////////////////////////////////////////////////////
 FloatList f__maxFL(const FloatList& flist)
 {
-    FloatList toret;
-    toret[0] = 0.0;
-    toret[1] = -1.0;
-    if(!flist.is_bound()) return toret;
-    int i, len = flist.size_of();
-
-    double m = -1.7E308;
-    for(i=0;i<len;i++)
-        if(flist[i]>m)
-        {
-            m = flist[i];
-            toret[1] = (double)i;
-        }
-    toret[0] = m;
-    return toret;
+  return f_minmax(flist,false);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -167,20 +151,27 @@ FloatList f__maxFL(const FloatList& flist)
 ///////////////////////////////////////////////////////////////////////////////
 FloatList f__minFL(const FloatList& flist)
 {
-    FloatList toret;
-    toret[0] = 0.0;
-    toret[1] = -1.0;
-    if(!flist.is_bound()) return toret;
-    unsigned int i, len = (unsigned int)flist.size_of();
-    double m = 1.7E308;
-    for(i=0;i<len;i++)
-        if(flist[i]<m)
-        {
-            m = flist[i];
-            toret[1] = (double)i;
-        }
-    toret[0] = m;
-    return toret;
+  return f_minmax(flist, true);
+}
+///////////////////////////////////////////////////////////////////////////////
+//template for count average value of list
+///////////////////////////////////////////////////////////////////////////////
+template<typename T_list>
+FLOAT f_average(const T_list& list)
+{
+  int len;
+  if(!list.is_bound() or ((len = list.size_of()) == 0))
+  {
+    return 0.0;
+  }
+
+  int i;
+  double toret = 0.0;
+  for(i=0;i<len;++i)
+  {
+    toret += (double)list[i];
+  }
+  return toret/(double)len;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -204,12 +195,7 @@ FloatList f__minFL(const FloatList& flist)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__averageFL(const FloatList& flist)
 {
-    if(!flist.is_bound()) return FLOAT();
-    double toret = 0.0;
-    int i, len = flist.size_of();
-    if(len==0) return FLOAT();
-    for(i=0;i<len;i++) toret += flist[i];
-    return FLOAT(toret / (double)len);
+  return f_average(flist);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -233,157 +219,177 @@ FLOAT f__averageFL(const FloatList& flist)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__averageIL(const IntegerList& ilist)
 {
-    int toret = 0;
-    int i, len = ilist.size_of();
-    if(len == 0) return FLOAT();
-    for(i=0;i<len;i++) toret += ilist[i];
-    return FLOAT(((double)toret / (double)len));
+  return f_average(ilist);
+}
+///////////////////////////////////////////////////////////////////////////////
+// template for update lists
+///////////////////////////////////////////////////////////////////////////////
+template<typename T_list>
+void f_update(T_list& head, const T_list& tail)
+{
+  if(!tail.is_bound())
+  {
+    return;
+  }
+
+  unsigned int i, count, len = tail.size_of();
+  if(head.is_bound())
+  {
+    count = (unsigned int)head.size_of();
+  } else {
+    count = 0;
+  }
+  head.set_size(count + len);
+  for(i=0;i<len;++i)
+  {
+    head[count] = tail[i];
+    ++count;
+  }
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-//  Function: f__stdFL
+//  Function: f__updateFL
 //
 //  Purpose:
-//    Return the normalized standard deviation of float list
-//    (so the average square distance from the center of elements in the list)
+//    Append tail to the end of head (head return as inout)
 //
 //  Parameters:
-//    flist - *in* <FloatList> - float list
+//    head - *in* <FloatList> - first part of the float list
+//    tail - *in* <FloatList> - second part of the float list
 //
 //  Return Value:
-//    float - normalized, standard derivate
+//    -
 //
 //  Errors:
 //    -
 //
 //  Detailed description:
-//    E.g.  list = {2.0, 4.0}
-//
-//          u = (2.0 + 4.0) / 2 <- *center of elements in the list*
-//
-//          len = sizeof(list)
-//
-//          [ ( (2.0-u)^2 + (4.0-u)^2 ) / len ] ^ (0.5)
+//    -
 //
 ///////////////////////////////////////////////////////////////////////////////
-FLOAT f__stdFL(const FloatList& flist)
+void f__updateFL(FloatList& head, const FloatList& tail)
 {
-    if(!flist.is_bound()) return FLOAT();
-    double toret = 0.0;
-    int i, len = flist.size_of();
-    if(len == 0) return FLOAT();
-    double u = (double)TCCMaths__Functions::f__averageFL(flist);
-    for(i=0;i<len;i++) toret += pow((double)flist[i]-u,2.0);
-    return FLOAT(pow(toret/((double)len-1),0.5));
+  f_update(head,tail);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-//  Function: f__stdFLL
+//  Function: f__updateIL
 //
 //  Purpose:
-//    Return the normalized standard deviation of float list  using custom
-//    center
-//    (so it is the average square distance from a user defined central value)
+//     Append tail to the end of head (head return as inout)
 //
 //  Parameters:
-//    u - *in* *float* - user defined central value
-//    flist - *in* <FloatList> - float list
+//    head - *in* <IntegerList> - first part of the integer list
+//    tail - *in* <IntegerList> - second part of the integer list
 //
 //  Return Value:
-//    float - normalized, standard derivate
+//    -
 //
 //  Errors:
 //    -
 //
 //  Detailed description:
-//    Note: u is the average value of flist and has to be calculated
-//    before a call to this function
-//
-//    E.g.  list = {2.0, 4.0}
-//
-//          u <- *user input*
-//
-//          len = sizeof(list)
-//
-//          [ ( (2.0-u)^2 + (4.0-u)^2 ) / len ] ^ (0.5)
+//    -
 //
 ///////////////////////////////////////////////////////////////////////////////
-FLOAT f__stdFLL(const FloatList& flist, const FLOAT& u)
+void f__updateIL(IntegerList& head, const IntegerList& tail)
+{
+  f_update(head,tail);
+}
+///////////////////////////////////////////////////////////////////////////////
+//template for count corrected standard deviation
+///////////////////////////////////////////////////////////////////////////////
+template<typename T_list>
+FLOAT f_std(const T_list& list, const FLOAT& in_u = FLOAT())
 {
-    if(!flist.is_bound()) FLOAT();
-    double toret = 0.0;
-    int i, len = flist.size_of();
-    if(len == 0) return FLOAT();
-    for(i=0;i<len;i++) toret += pow((double)flist[i]-(double)u,2.0);
-    return FLOAT(pow(toret/((double)(len-1)),0.5));
+  int len;
+  if(!list.is_bound() or ((len = list.size_of()) < 2))
+  {
+    return 0.0;
+  }
+
+  double u, toret = 0.0;
+  if (!in_u.is_bound())
+  {
+    u = f_average(list);
+  } else {
+    u = in_u;
+  }
+  double x;
+  for(int i=0;i<len;++i)
+  {
+    x = (double)list[i]-u;
+    toret += x*x;
+  }
+
+  return pow(toret/(double)(len-1),0.5);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-//  Function: f__updateFL
+//  Function: f__stdFL
 //
 //  Purpose:
-//    Append tail to the end of head (head return as inout)
+//    Return the normalized standard deviation of float list
+//    (so the average square distance from the center of elements in the list)
 //
 //  Parameters:
-//    head - *in* <FloatList> - first part of the float list
-//    tail - *in* <FloatList> - second part of the float list
+//    flist - *in* <FloatList> - float list
 //
 //  Return Value:
-//    -
+//    float - normalized, standard derivate
 //
 //  Errors:
 //    -
 //
 //  Detailed description:
-//    -
+//    E.g.  list = {2.0, 4.0}
+//
+//          u = (2.0 + 4.0) / 2 <- *center of elements in the list*
+//
+//          len = sizeof(list)
+//
+//          [ ( (2.0-u)^2 + (4.0-u)^2 ) / len ] ^ (0.5)
 //
 ///////////////////////////////////////////////////////////////////////////////
-void f__updateFL(FloatList& head, const FloatList& tail)
+FLOAT f__stdFL(const FloatList& flist)
 {
-    unsigned int i, count, len;
-    if(!tail.is_bound()) return;
-    len = tail.size_of();
-    if(head.is_bound()) count = (unsigned int)head.size_of();
-    else count = 0;
-    for(i=0;i<len;i++)
-    {
-        head[count] = tail[i];
-        count++;
-    }
+  return f_std(flist);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-//  Function: f__updateIL
+//  Function: f__stdFLL
 //
 //  Purpose:
-//     Append tail to the end of head (head return as inout)
+//    Return the normalized standard deviation of float list  using custom
+//    center
+//    (so it is the average square distance from a user defined central value)
 //
 //  Parameters:
-//    head - *in* <IntegerList> - first part of the integer list
-//    tail - *in* <IntegerList> - second part of the integer list
+//    u - *in* *float* - user defined central value
+//    flist - *in* <FloatList> - float list
 //
 //  Return Value:
-//    -
+//    float - normalized, standard derivate
 //
 //  Errors:
 //    -
 //
 //  Detailed description:
-//    -
+//    Note: u is the average value of flist and has to be calculated
+//    before a call to this function
+//
+//    E.g.  list = {2.0, 4.0}
+//
+//          u <- *user input*
+//
+//          len = sizeof(list)
+//
+//          [ ( (2.0-u)^2 + (4.0-u)^2 ) / len ] ^ (0.5)
 //
 ///////////////////////////////////////////////////////////////////////////////
-void f__updateIL(IntegerList& head, const IntegerList& tail)
+FLOAT f__stdFLL(const FloatList& flist, const FLOAT& u)
 {
-    unsigned int i, count, len;
-    if(!tail.is_bound()) return;
-    len = tail.size_of();
-    if(head.is_bound()) count = (unsigned int)head.size_of();
-    else count = 0;
-    for(i=0;i<len;i++)
-    {
-        head[count] = tail[i];
-        count++;
-    }
+  return f_std(flist,u);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -415,11 +421,7 @@ void f__updateIL(IntegerList& head, const IntegerList& tail)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__stdIL(const IntegerList& ilist)
 {
-    double toret = 0.0;
-    int i, len = ilist.size_of();
-    double u = (double)TCCMaths__Functions::f__averageIL(ilist);
-    for(i=0;i<len;i++) toret += pow((double)ilist[i]-u,2.0);
-    return FLOAT(pow(toret/((double)len-1),0.5));
+  return f_std(ilist);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -454,12 +456,7 @@ FLOAT f__stdIL(const IntegerList& ilist)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__stdILL(const IntegerList& ilist, const FLOAT& u)
 {
-    if(!ilist.is_bound()) FLOAT();
-    double toret = 0.0;
-    int i, len = ilist.size_of();
-    if(len == 0) return FLOAT();
-    for(i=0;i<len;i++) toret += pow((double)ilist[i]-(double)u,2.0);
-    return FLOAT(pow(toret/((double)(len-1)),0.5));
+  return f_std(ilist,u);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -491,17 +488,20 @@ FLOAT f__stdILL(const IntegerList& ilist, const FLOAT& u)
 ///////////////////////////////////////////////////////////////////////////////
 FloatList f__sinVL(const FLOAT& freq, const FLOAT& altitude, const FLOAT& start__val, const INTEGER& len, const FLOAT& step)
 {
-    double pi = 3.1415926535;
-    int i;
-    double tmp = (double)start__val;
-    FloatList toret;
-    for(i=0;i<(int)len;i++)
+  int i;
+  double tmp = start__val;
+  FloatList toret;
+  double common = 2.0 * M_PI * freq;
+  if (len > 0)
+  {
+    toret.set_size(len);
+    for ( i = 0; i < len; ++i)
     {
-        toret[i] = (double)altitude * sin(2.0 * pi * (double)freq * tmp);
-        tmp += (double)step;
+      toret[i] = altitude * sin(common * tmp);
+      tmp += step;
     }
-
-    return (toret);
+  }
+    return toret;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -533,17 +533,20 @@ FloatList f__sinVL(const FLOAT& freq, const FLOAT& altitude, const FLOAT& start_
 ///////////////////////////////////////////////////////////////////////////////
 FloatList f__cosVL(const FLOAT& freq, const FLOAT& altitude, const FLOAT& start__val, const INTEGER& len, const FLOAT& step)
 {
-    double pi = 3.1415926535;
-    int i;
-    double tmp = (double)start__val;
-    FloatList toret;
-    for(i=0;i<(int)len;i++)
+  int i;
+  double tmp = start__val;
+  FloatList toret;
+  double common = 2.0 * M_PI * freq;
+  if (len > 0)
+  {
+    toret.set_size(len);
+    for ( i = 0; i < len; ++i)
     {
-        toret[i] = (double)altitude * cos(2.0 * pi * (double)freq * tmp);
-        tmp += (double)step;
+      toret[i] = altitude * cos(common * tmp);
+      tmp += step;
     }
-
-    return (toret);
+  }
+  return toret;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -567,7 +570,7 @@ FloatList f__cosVL(const FLOAT& freq, const FLOAT& altitude, const FLOAT& start_
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__sin(const FLOAT& angle)
 {
-  return FLOAT(sin(angle));
+  return sin(angle);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -591,7 +594,7 @@ FLOAT f__sin(const FLOAT& angle)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__cos(const FLOAT& angle)
 {
-  return FLOAT(cos(angle));
+  return cos(angle);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -615,7 +618,7 @@ FLOAT f__cos(const FLOAT& angle)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__asin(const FLOAT& val)
 {
-  return FLOAT(asin(val));
+  return asin(val);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -639,7 +642,7 @@ FLOAT f__asin(const FLOAT& val)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__acos(const FLOAT& val)
 {
-  return FLOAT(acos(val));
+  return acos(val);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -664,7 +667,7 @@ FLOAT f__acos(const FLOAT& val)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__powFF(const FLOAT& base, const FLOAT& expo)
 {
-  return FLOAT(pow(base, expo));
+  return pow(base, expo);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -689,7 +692,7 @@ FLOAT f__powFF(const FLOAT& base, const FLOAT& expo)
 ///////////////////////////////////////////////////////////////////////////////
 INTEGER f__powII(const INTEGER& base, const INTEGER& expo)
 {
-  return INTEGER((int)pow(base, expo));
+  return float2int(pow(int2float(base), int2float(expo)));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -714,7 +717,7 @@ INTEGER f__powII(const INTEGER& base, const INTEGER& expo)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__powIF(const INTEGER& base, const FLOAT& expo)
 {
-  return FLOAT(pow(base, expo));
+  return pow(int2float(base), expo);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -739,7 +742,7 @@ FLOAT f__powIF(const INTEGER& base, const FLOAT& expo)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__powFI(const FLOAT& base, const INTEGER& expo)
 {
-  return FLOAT(pow(base, expo));
+  return pow(base, int2float(expo));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -763,7 +766,7 @@ FLOAT f__powFI(const FLOAT& base, const INTEGER& expo)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__sqrF(const FLOAT& base)
 {
-  return FLOAT(base*base);
+  return base*base;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -787,7 +790,7 @@ FLOAT f__sqrF(const FLOAT& base)
 ///////////////////////////////////////////////////////////////////////////////
 INTEGER f__sqrI(const INTEGER& base)
 {
-  return INTEGER(base*base);
+  return base*base;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -811,7 +814,7 @@ INTEGER f__sqrI(const INTEGER& base)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__sqrtF(const FLOAT& base)
 {
-  return FLOAT(sqrt(base));
+  return sqrt(base);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -835,7 +838,7 @@ FLOAT f__sqrtF(const FLOAT& base)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__sqrtI(const INTEGER& base)
 {
-  return FLOAT(sqrt((double)base));
+  return sqrt(int2float(base));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -859,7 +862,7 @@ FLOAT f__sqrtI(const INTEGER& base)
 ///////////////////////////////////////////////////////////////////////////////
 INTEGER f__ceil(const FLOAT& val)
 {
-  return INTEGER((int)ceil(val));
+  return float2int(ceil(val));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -883,7 +886,7 @@ INTEGER f__ceil(const FLOAT& val)
 ///////////////////////////////////////////////////////////////////////////////
 INTEGER f__floor(const FLOAT& val)
 {
-  return INTEGER((int)floor(val));
+  return float2int(floor(val));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -907,7 +910,7 @@ INTEGER f__floor(const FLOAT& val)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__exp(const FLOAT& val)
 {
-  return FLOAT(exp(val));
+  return exp(val);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -931,7 +934,7 @@ FLOAT f__exp(const FLOAT& val)
 ///////////////////////////////////////////////////////////////////////////////
 FLOAT f__log(const FLOAT& val)
 {
-  return FLOAT(log(val));
+  return log(val);
 }
 
 }
diff --git a/src/TCCMaths_Functions.ttcn b/src/TCCMaths_Functions.ttcn
index 889f6f5982c32fb55e4869cde73163188f1b208c..ba9fa568e6952d12c38d744304ec67d5dc3525fb 100644
--- a/src/TCCMaths_Functions.ttcn
+++ b/src/TCCMaths_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2008                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCMaths_Functions.ttcn
 //  Description:        TCC Useful Functions: Math Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2008-12-10
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCMaths_GenericTypes.ttcn b/src/TCCMaths_GenericTypes.ttcn
index 2197a64686057c588d976d47c9b6bb73748ba11f..3d783063364fe06078d909f03baae32f592bd584 100644
--- a/src/TCCMaths_GenericTypes.ttcn
+++ b/src/TCCMaths_GenericTypes.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2007                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCMaths_GenericTypes.ttcn
 //  Description:        TCC Useful Functions: Generic Types For Maths
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2007-11-12
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCMessageHandling.cc b/src/TCCMessageHandling.cc
index ad118818f42ba7ff168e531eac377f58829f55a2..07893e7de839fcc95d2b15adf1ecc06c67a84bed 100644
--- a/src/TCCMessageHandling.cc
+++ b/src/TCCMessageHandling.cc
@@ -1,18 +1,16 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2013                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:     TCCMessageHandling.cc
-//  Rev:      R25A
+//  Rev:      R30A
 //  Prodnr:   CNL 113 472
-//  Updated:  2013-11-07
-//  Contact:  http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCMessageHandling_Functions.ttcn b/src/TCCMessageHandling_Functions.ttcn
index cc84f67a259bfe5694d925df28de9eba75e7e301..6d2b3f9b5dde570e448aaa47c8074c00cd50ece4 100644
--- a/src/TCCMessageHandling_Functions.ttcn
+++ b/src/TCCMessageHandling_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2013                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCMessageHandling_Functions.ttcn
 //  Description:        TCC Useful Functions: MessageHandling Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2013-03-28
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCOpenSecurity.cc b/src/TCCOpenSecurity.cc
new file mode 100644
index 0000000000000000000000000000000000000000..527faee0024f74d9ad2f3a6f8448791fc3751e61
--- /dev/null
+++ b/src/TCCOpenSecurity.cc
@@ -0,0 +1,1128 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
+///////////////////////////////////////////////////////////////////////////////
+//
+//  File:               TCCOpenSecurity.cc
+//  Description:        TCC Useful Functions: Security Functions
+//  Rev:                R30A
+//  Prodnr:             CNL 113 472
+//
+///////////////////////////////////////////////////////////////////////////////
+#include "TCCOpenSecurity_Functions.hh"
+
+#include <openssl/md5.h>
+#include <openssl/hmac.h>
+#include <openssl/aes.h>
+#include <openssl/des.h>
+#include <openssl/evp.h>
+#include <openssl/dh.h>
+#include <openssl/sha.h>
+#include <openssl/rand.h>
+
+namespace TCCOpenSecurity__Functions {
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculateRAND__oct
+//
+//  Purpose:
+//    Compute random value
+//
+//  Parameters:
+//      pl__length - *in* *integer* -  length of random value
+//
+//  Return Value:
+//      random value - *out* *octetstring* -  random value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING  f__calculateRAND__oct(const INTEGER& pl__length)
+{
+  int rand_length = (int)pl__length;
+  unsigned char rand_val[rand_length];
+  RAND_bytes(rand_val, rand_length);
+
+  return OCTETSTRING(rand_length, rand_val);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculateSHA1
+//
+//  Purpose:
+//    Compute SHA1 hash value
+//
+//  Parameters:
+//      pszHashInput - *in* *charstring* -  input value to compute hash of
+//
+//  Return Value:
+//      hashValue - *out* *charstring* -  hexa hash value of input
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+CHARSTRING  f__calculateSHA1(const CHARSTRING& pszHashInput)
+{
+  unsigned char sha1[SHA_DIGEST_LENGTH];
+  SHA1((const unsigned char*)(const char *)pszHashInput,pszHashInput.lengthof(),sha1);
+
+  return oct2str(OCTETSTRING(SHA_DIGEST_LENGTH,sha1));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculateSHA1__oct
+//
+//  Purpose:
+//    Compute SHA1 hash value and return in octetstring
+//
+//  Parameters:
+//      pszHashInput - *in* *octetstring* -  input value to compute hash of
+//
+//  Return Value:
+//      hashValue - *out* *octetstring* -  hash value of input in octetstring
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING  f__calculateSHA1__oct(const OCTETSTRING& pszHashInput)
+{
+  unsigned char sha1[SHA_DIGEST_LENGTH];
+  SHA1((const unsigned char*)pszHashInput,pszHashInput.lengthof(),sha1);
+
+  return OCTETSTRING(SHA_DIGEST_LENGTH,sha1);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculateHMACMD5
+//
+//  Purpose:
+//      Calculate the HMAC MD5 value of a message with specified 64 bit key.
+//
+//  Parameters:
+//      msg - *in* *octetstring* - message to be hashed
+//      key - *in* *OCT_64*      - 64 bit key of the hash function
+//
+//  Return Value:
+//      octetstring - Hash value (16 octet - 128 bit)
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - (should be kept because of backward compatibility reasons)
+//      - HMAC() is an openssl specific function, should be found under openssl/hmac.h
+//      - key can only be 64 bit (any other case please use f_calculate_HMAC_MD5)
+//      - the length of generated hash value can only be 128 bit (any other case please use f_calculate_HMAC_MD5)
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__calculateHMACMD5(const OCTETSTRING& msg, const OCT__64& key)
+{
+  unsigned char Response[16];
+  int msglen = msg.lengthof();
+
+  HMAC(EVP_md5(), key, 64, msg, msglen, Response, NULL);
+
+  return OCTETSTRING(16, (const unsigned char *)Response);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculate__HMAC__MD5
+//
+//  Purpose:
+//      Calculate the HMAC MD5 value of a message with specified key.
+//
+//  Parameters:
+//      pl_key - *in* *octetstring*   - key of the hash function
+//      pl_input - *in* *octetstring* - message to be hashed
+//      pl_length - *in* *integer*    - length of the output hash value (should be 16 in most of the cases)
+//
+//  Return Value:
+//      octetstring - Hash value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - HMAC() is an openssl specific function, should be found under openssl/hmac.h
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__calculate__HMAC__MD5(const OCTETSTRING& pl_key,const OCTETSTRING& pl_input,const INTEGER& pl_length)
+{
+  unsigned int out_length;
+  unsigned char output[EVP_MAX_MD_SIZE];
+  HMAC(EVP_md5(), pl_key, (size_t) pl_key.lengthof(), pl_input, (size_t) pl_input.lengthof(), output, &out_length);
+
+  return OCTETSTRING(pl_length, output);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculate__HMAC__SHA1
+//
+//  Purpose:
+//      Calculate the HMAC SHA1 value of a message with specified key.
+//
+//  Parameters:
+//      pl_key - *in* *octetstring*   - key of the hash function
+//      pl_input - *in* *octetstring* - message to be hashed
+//      pl_length - *in* *integer*    - length of the output hash value (should be 16 in most of the cases)
+//
+//  Return Value:
+//      octetstring - Hash value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - HMAC() is an openssl specific function, should be found under openssl/hmac.h
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__calculate__HMAC__SHA1(const OCTETSTRING& pl_key,const OCTETSTRING& pl_input,const INTEGER& pl_length)
+{
+  unsigned int out_length;
+  unsigned char output[EVP_MAX_MD_SIZE];
+  HMAC(EVP_sha1(), pl_key, (size_t) pl_key.lengthof(), pl_input, (size_t) pl_input.lengthof(), output, &out_length);
+
+  return OCTETSTRING(pl_length, output);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculate__HMAC__SHA256
+//
+//  Purpose:
+//      Calculate the HMAC SHA256 value of a message with specified key.
+//
+//  Parameters:
+//      pl_key - *in* *octetstring*   - key of the hash function
+//      pl_input - *in* *octetstring* - message to be hashed
+//      pl_length - *in* *integer*    - length of the output hash value (should be 32 in most of the cases)
+//
+//  Return Value:
+//      octetstring - Hash value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - HMAC() is an openssl specific function, should be found under openssl/hmac.h
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__calculate__HMAC__SHA256(const OCTETSTRING& pl_key,const OCTETSTRING& pl_input,const INTEGER& pl_length)
+{
+  unsigned int out_length;
+  unsigned char output[EVP_MAX_MD_SIZE];
+  HMAC(EVP_sha256(), pl_key, (size_t) pl_key.lengthof(), pl_input, (size_t) pl_input.lengthof(), output, &out_length);
+
+  return OCTETSTRING(pl_length, output);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__AES__CBC__128__Encrypt__OpenSSL
+//
+//  Purpose: Calculate AES 128 CBC encrypted value
+//
+//  Parameters:
+//          p__key       - *in* *octetstring*   - Key
+//          p__iv        - *in* *octetstring*   - Initialiazation Vector
+//          p__data      - *in* *octetstring*   - Data
+//
+//  Return Value:
+//         octetstring - encrypted value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__AES__CBC__128__Encrypt__OpenSSL (const OCTETSTRING& p_key,const OCTETSTRING& p_iv,const OCTETSTRING& p_data)
+{
+
+  const unsigned char* key=(const unsigned char*)p_key;
+  const unsigned char* iv=(const unsigned char*)p_iv;
+  size_t data_len = p_data.lengthof();
+  const unsigned char* data=(const unsigned char*)p_data;
+  size_t iv_len = p_iv.lengthof();
+
+  AES_KEY enc_key;
+  unsigned char enc_data[data_len];
+  unsigned char k_iv[iv_len];
+
+  memcpy(k_iv,iv,iv_len);
+
+  AES_set_encrypt_key(key, 128, &enc_key);
+
+  AES_cbc_encrypt(data, enc_data,
+    data_len, &enc_key,
+    k_iv, AES_ENCRYPT);
+
+  return OCTETSTRING(data_len, enc_data);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__AES__CBC__128__Decrypt__OpenSSL
+//
+//  Purpose: Dectrypts AES 128 CBC encrypted data
+//
+//  Parameters:
+//          p__key       - *in* *octetstring*   - Key
+//          p__iv        - *in* *octetstring*   - Initialiazation Vector
+//          p__data      - *in* *octetstring*   - Encrypted Value
+//
+//  Return Value:
+//         octetstring - decrypted original data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__AES__CBC__128__Decrypt__OpenSSL (const OCTETSTRING& p_key,const OCTETSTRING& p_iv,const OCTETSTRING& p_data)
+{
+
+  const unsigned char* key=(const unsigned char*)p_key;
+  const unsigned char* iv=(const unsigned char*)p_iv;
+  size_t data_len = p_data.lengthof();
+  const unsigned char* data=(const unsigned char*)p_data;
+  size_t iv_len = p_iv.lengthof();
+
+  AES_KEY dec_key;
+  unsigned char dec_data[data_len];
+  unsigned char k_iv[iv_len];
+
+  memcpy(k_iv,iv,iv_len);
+
+  AES_set_decrypt_key(key, 128, &dec_key);
+
+  AES_cbc_encrypt(data, dec_data,
+    data_len, &dec_key,
+    k_iv, AES_DECRYPT);
+
+  return OCTETSTRING(data_len, dec_data);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__AES__CBC__Encrypt__OpenSSL
+//
+//  Purpose: Calculate AES 128 CBC encrypted value with arbitrary key length
+//
+//  Parameters:
+//          p__key       - *in* *octetstring*   - Key
+//          p__iv        - *in* *octetstring*   - Initialiazation Vector
+//          p__data      - *in* *octetstring*   - Data
+//
+//  Return Value:
+//         octetstring - encrypted value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__AES__CBC__Encrypt__OpenSSL (const OCTETSTRING& p_key,const OCTETSTRING& p_iv,const OCTETSTRING& p_data)
+{
+  const unsigned char* key=(const unsigned char*)p_key;
+  const int key_len_bit = p_key.lengthof() * 8;
+  const unsigned char* iv=(const unsigned char*)p_iv;
+  size_t data_len = p_data.lengthof();
+  const unsigned char* data=(const unsigned char*)p_data;
+  size_t iv_len = p_iv.lengthof();
+
+  AES_KEY enc_key;
+  unsigned char enc_data[data_len];
+  unsigned char k_iv[iv_len];
+
+  memcpy(k_iv,iv,iv_len);
+
+  AES_set_encrypt_key(key, key_len_bit, &enc_key);
+
+  AES_cbc_encrypt(data, enc_data,
+    data_len, &enc_key,
+    k_iv, AES_ENCRYPT);
+
+  return OCTETSTRING(data_len, enc_data);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__AES__CBC__Decrypt__OpenSSL
+//
+//  Purpose: Dectrypts AES CBC encrypted data with arbitrary key length
+//
+//  Parameters:
+//          p__key       - *in* *octetstring*   - Key
+//          p__iv        - *in* *octetstring*   - Initialiazation Vector
+//          p__data      - *in* *octetstring*   - Encrypted Value
+//
+//  Return Value:
+//         octetstring - decrypted original data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__AES__CBC__Decrypt__OpenSSL (const OCTETSTRING& p_key,const OCTETSTRING& p_iv,const OCTETSTRING& p_data)
+{
+
+  const unsigned char* key=(const unsigned char*)p_key;
+  const int key_len_bit = p_key.lengthof() * 8;
+  const unsigned char* iv=(const unsigned char*)p_iv;
+  size_t data_len = p_data.lengthof();
+  const unsigned char* data=(const unsigned char*)p_data;
+  size_t iv_len = p_iv.lengthof();
+
+  AES_KEY dec_key;
+  unsigned char dec_data[data_len];
+  unsigned char k_iv[iv_len];
+
+  memcpy(k_iv,iv,iv_len);
+
+  AES_set_decrypt_key(key, key_len_bit, &dec_key);
+
+  AES_cbc_encrypt(data, dec_data,
+    data_len, &dec_key,
+    k_iv, AES_DECRYPT);
+
+  return OCTETSTRING(data_len, dec_data);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef__3DES__ECB__Encrypt
+//
+//  Purpose: Encrypts data using 3DES algorithm in ECB mode.
+//
+//  Parameters:
+//          pl__data    - *in* *octetstring*   - Data to be encrypted
+//          pl__key     - *in* *octetstring*   - Key
+//
+//  Return Value:
+//         octetstring - encrypted data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING ef__3DES__ECB__Encrypt (const OCTETSTRING& pl__data, const OCTETSTRING& pl__key, const BOOLEAN& pl__use__padding)
+{
+  if(pl__data.lengthof()==0){
+    return OCTETSTRING(0,NULL);
+  }
+
+  int outl = 0;
+  int position = 0;
+  OCTETSTRING ret_val=OCTETSTRING(0,NULL);
+   unsigned char* outbuf=NULL;
+  const unsigned char* data= (const unsigned char*)pl__data;
+
+  EVP_CIPHER_CTX ctx;
+  EVP_CIPHER_CTX_init(&ctx);
+
+  if(EVP_EncryptInit_ex(&ctx, EVP_des_ede3_ecb(), NULL, pl__key, NULL))
+  {
+    int block_size = EVP_CIPHER_CTX_block_size(&ctx);
+     if(!pl__use__padding) {  // the padding is used by default
+      EVP_CIPHER_CTX_set_padding(&ctx,0);
+      if(pl__data.lengthof()%block_size){
+        TTCN_warning("ef_3DES_ECB_Encrypt: The length of the pl_data should be n * %d (the block size) if padding is not used.", block_size);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+    }
+    if((outbuf = (unsigned char*)Malloc(pl__data.lengthof() + block_size)) != NULL)
+    {
+      if(!EVP_EncryptUpdate(&ctx, outbuf, &outl, data, pl__data.lengthof())){
+        TTCN_warning("ef_3DES_ECB_Encrypt: EVP_EncryptUpdate failed.");
+        Free(outbuf);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+      position = outl;
+      if(!EVP_EncryptFinal_ex(&ctx, &outbuf[position], &outl)){
+        TTCN_warning("ef_3DES_ECB_Encrypt: EVP_EncryptFinal_ex failed.");
+        Free(outbuf);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+
+      position += outl;
+      ret_val=OCTETSTRING(position, outbuf);
+      Free(outbuf);
+    }
+
+    EVP_CIPHER_CTX_cleanup(&ctx);
+
+  } else {
+        TTCN_warning("ef_3DES_ECB_Encrypt: EVP_EncryptInit_ex failed.");
+        return OCTETSTRING(0,NULL);
+  }
+
+
+  return ret_val;
+
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef__3DES__ECB__Decrypt
+//
+//  Purpose:  Dectrypts 3DES ECB encrypted data.
+//
+//  Parameters:
+//          pl__data      - *in* *octetstring*   - Encrytped data
+//          pl__key       - *in* *octetstring*   - Key
+//
+//  Return Value:
+//         octetstring - decrypted data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING ef__3DES__ECB__Decrypt (const OCTETSTRING& pl__data, const OCTETSTRING& pl__key, const BOOLEAN& pl__use__padding)
+{
+  if(pl__data.lengthof()==0){
+    return OCTETSTRING(0,NULL);
+  }
+  int outl = 0;
+  int position = 0;
+  OCTETSTRING ret_val=OCTETSTRING(0,NULL);
+   unsigned char* outbuf=NULL;
+  const unsigned char* data= (const unsigned char*)pl__data;
+
+  EVP_CIPHER_CTX ctx;
+  EVP_CIPHER_CTX_init(&ctx);
+
+  if(EVP_DecryptInit_ex(&ctx, EVP_des_ede3_ecb(), NULL, pl__key, NULL))
+  {
+    int block_size = EVP_CIPHER_CTX_block_size(&ctx);
+    if(pl__data.lengthof()%block_size){
+      TTCN_warning("ef_3DES_ECB_Decrypt: The length of the pl_data should be n * %d (the block size)!", block_size);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+      return OCTETSTRING(0,NULL);
+    }
+     if(!pl__use__padding) {  // the padding is used by default
+      EVP_CIPHER_CTX_set_padding(&ctx,0);
+    }
+    if((outbuf = (unsigned char*)Malloc(pl__data.lengthof() + block_size)) != NULL)
+    {
+      if(!EVP_DecryptUpdate(&ctx, outbuf, &outl, data, pl__data.lengthof())){
+        TTCN_warning("ef_3DES_ECB_Decrypt: EVP_DecryptUpdate failed.");
+        Free(outbuf);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+      position = outl;
+
+      if(!EVP_DecryptFinal_ex(&ctx, &outbuf[position], &outl)){
+        TTCN_warning("ef_3DES_ECB_Decrypt: EVP_DecryptFinal_ex failed.");
+        Free(outbuf);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+
+      position += outl;
+      ret_val=OCTETSTRING(position, outbuf);
+      Free(outbuf);
+    }
+
+    EVP_CIPHER_CTX_cleanup(&ctx);
+
+  } else {
+        TTCN_warning("ef_3DES_ECB_Decrypt: EVP_DecryptInit_ex failed.");
+        return OCTETSTRING(0,NULL);
+  }
+
+
+  return ret_val;
+
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef__3DES__CBC__Encrypt
+//
+//  Purpose: Encrypts data using TripleDES algorithm in CBC mode.
+//
+//  Parameters:
+//          pl__data      - *in* *octetstring*   - Data to be encrypted
+//          pl__key       - *in* *octetstring*   - Key
+//          pl__iv        - *in* *octetstring*   - Initialiazation Vector
+//
+//  Return Value:
+//         octetstring - decrypted original data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING ef__3DES__CBC__Encrypt (const OCTETSTRING& pl__data, const OCTETSTRING& pl__key, const OCTETSTRING& pl__iv, const BOOLEAN& pl__use__padding)
+{
+  if(pl__data.lengthof()==0){
+    return OCTETSTRING(0,NULL);
+  }
+  int outl = 0;
+  int position = 0;
+  OCTETSTRING ret_val=OCTETSTRING(0,NULL);
+   unsigned char* outbuf=NULL;
+  const unsigned char* data= (const unsigned char*)pl__data;
+
+  EVP_CIPHER_CTX ctx;
+  EVP_CIPHER_CTX_init(&ctx);
+
+  if(EVP_EncryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, pl__key, pl__iv))
+  {
+    int block_size = EVP_CIPHER_CTX_block_size(&ctx);
+     if(!pl__use__padding) {  // the padding is used by default
+      EVP_CIPHER_CTX_set_padding(&ctx,0);
+      if(pl__data.lengthof()%block_size){
+        TTCN_warning("ef_3DES_CBC_Encrypt: The length of the pl_data should be n * %d (the block size) if padding is not used.", block_size);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+    }
+    if((outbuf = (unsigned char*)Malloc(pl__data.lengthof() + block_size)) != NULL)
+    {
+      if(!EVP_EncryptUpdate(&ctx, outbuf, &outl, data, pl__data.lengthof())){
+        TTCN_warning("ef_3DES_CBC_Encrypt: EVP_EncryptUpdate failed.");
+        Free(outbuf);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+
+      position = outl;
+
+      if(!EVP_EncryptFinal_ex(&ctx, &outbuf[position], &outl)){
+        TTCN_warning("ef_3DES_CBC_Encrypt: EVP_EncryptFinal_ex failed.");
+        Free(outbuf);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+
+      position += outl;
+    }
+
+    ret_val=OCTETSTRING(position, outbuf);
+    Free(outbuf);
+    EVP_CIPHER_CTX_cleanup(&ctx);
+
+  } else {
+        TTCN_warning("ef_3DES_CBC_Encrypt: EVP_EncryptInit_ex failed.");
+        return OCTETSTRING(0,NULL);
+  }
+
+
+  return ret_val;
+
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__3DES__CBC__Decrypt
+//
+//  Purpose: Decrypting TripleDES encypted data.
+//
+//  Parameters:
+//          pl__data      - *in* *octetstring*   - Encrypted Value
+//          pl__key       - *in* *octetstring*   - Key
+//          pl__iv        - *in* *octetstring*   - Initialiazation Vector
+//
+//  Return Value:
+//         octetstring - encrypted value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING ef__3DES__CBC__Decrypt (const OCTETSTRING& pl__data, const OCTETSTRING& pl__key, const OCTETSTRING& pl__iv, const BOOLEAN& pl__use__padding)
+{
+  if(pl__data.lengthof()==0){
+    return OCTETSTRING(0,NULL);
+  }
+  int outl = 0;
+  int position = 0;
+  OCTETSTRING ret_val=OCTETSTRING(0,NULL);
+   unsigned char* outbuf=NULL;
+  const unsigned char* data= (const unsigned char*)pl__data;
+
+  EVP_CIPHER_CTX ctx;
+  EVP_CIPHER_CTX_init(&ctx);
+
+  if(EVP_DecryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, pl__key, pl__iv))
+  {
+    int block_size = EVP_CIPHER_CTX_block_size(&ctx);
+    if(pl__data.lengthof()%block_size){
+      TTCN_warning("ef__3DES__CBC__Decrypt: The length of the pl_data should be n * %d (the block size)!", block_size);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+      return OCTETSTRING(0,NULL);
+    }
+     if(!pl__use__padding) {  // the padding is used by default
+      EVP_CIPHER_CTX_set_padding(&ctx,0);
+    }
+    if((outbuf = (unsigned char*)Malloc(pl__data.lengthof() + block_size)) != NULL)
+    {
+      if(!EVP_DecryptUpdate(&ctx, outbuf, &outl, data, pl__data.lengthof())){
+        TTCN_warning("ef_3DES_CBC_Decrypt: EVP_DecryptUpdate failed.");
+        Free(outbuf);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+;
+      position = outl;
+
+      if(!EVP_DecryptFinal_ex(&ctx, &outbuf[position], &outl)){
+        TTCN_warning("ef_3DES_ECB_Decrypt: EVP_DecryptFinal_ex failed.");
+        Free(outbuf);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return OCTETSTRING(0,NULL);
+      }
+      position += outl;
+      ret_val=OCTETSTRING(position, outbuf);
+      Free(outbuf);
+    }
+
+    EVP_CIPHER_CTX_cleanup(&ctx);
+
+  } else {
+        TTCN_warning("ef_3DES_CBC_Decrypt: EVP_DecryptInit_ex failed.");
+        return OCTETSTRING(0,NULL);
+  }
+
+
+  return ret_val;
+
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_Calculate__AES__XCBC__128
+//
+//  Purpose: Calculates the AES XCBC value of the data with a 128 bit key.
+//
+//  Parameters:
+//          pl__data       - *in* *octetstring*   - Data
+//          pl__key        - *in* *octetstring*   - Key
+//          pl__out__length - *in* *integer*       - Length of the output
+//
+//  Return Value:
+//         octetstring - AES XCBC value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      AES XCBC generates a 16 byte long value which can be truncated
+//      to a length given in pl__out__length.
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING ef__Calculate__AES__XCBC__128 (const OCTETSTRING& pl__data, const OCTETSTRING& pl__key, const INTEGER& pl__out__length)
+{
+  const int data_length = pl__data.lengthof();
+  const unsigned char* data = (const unsigned char*)pl__data;
+  const int block_size = 16;
+  int outl;
+
+  unsigned char key1[block_size] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
+  unsigned char key2[block_size] = { 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 };
+  unsigned char key3[block_size] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 };
+  unsigned char e[block_size] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+  EVP_CIPHER_CTX ctx;
+  EVP_CIPHER_CTX_init(&ctx);
+
+  EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, pl__key, NULL);
+  EVP_EncryptUpdate(&ctx, key1, &outl, key1, block_size);
+  EVP_CIPHER_CTX_cleanup(&ctx);
+
+  EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, pl__key, NULL);
+  EVP_EncryptUpdate(&ctx, key2, &outl, key2, block_size);
+  EVP_CIPHER_CTX_cleanup(&ctx);
+
+  EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, pl__key, NULL);
+  EVP_EncryptUpdate(&ctx, key3, &outl, key3, block_size);
+  EVP_CIPHER_CTX_cleanup(&ctx);
+
+  if(EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key1, NULL))
+  {
+    for(int i = 0; i < data_length - block_size; i += block_size)
+    {
+      for(int j = 0; j < block_size; j++)
+      {
+        e[j] ^= data[i+j];
+      }
+
+      EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key1, NULL);
+      EVP_EncryptUpdate(&ctx, e, &outl, e, block_size);
+      EVP_CIPHER_CTX_cleanup(&ctx);
+    }
+
+    int last_block_length = data_length % block_size;
+
+    if((last_block_length == 0) && (data_length != 0))
+    {
+      for(int i = 0; i < block_size; i++)
+      {
+        e[i] = data[data_length - block_size + i] ^ e[i] ^ key2[i];
+      }
+    } else {
+      int i = 0;
+
+      while(i < last_block_length)
+      {
+        e[i] = data[data_length - last_block_length + i] ^ e[i] ^ key3[i];
+        i++;
+      }
+
+      e[i] = 0x80 ^ e[i] ^ key3[i];
+      i++;
+
+
+      while(i < block_size)
+      {
+        e[i] ^= key3[i];
+        i++;
+      }
+
+    }
+    EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key1, NULL);
+    EVP_EncryptUpdate(&ctx, e, &outl, e, block_size);
+    EVP_CIPHER_CTX_cleanup(&ctx);
+
+    return OCTETSTRING(pl__out__length, (const unsigned char*)e);
+
+  }
+  return OCTETSTRING(0,NULL);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_DH_generate_private_public_keys
+//
+//  Purpose: Generates public and private keys (this party).
+//
+//  Parameters:
+//          pl__keyLength - *in* *integer*          - Key length (bytes)
+//          pl__pubkey    - *inout* *octetstring*   - Public key (other party)
+//          pl__privkey   - *inout* *octetstring*   - Private key (this party)
+//
+//  Return Value:
+//         octetstring - DH shared secret
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      Computes the shared secret from the originating side's private key and
+//      the public key of the responding side as described in DH group 1, 2 and 14.
+//      Keys must be either 96, 128 or 256 bytes long.
+//
+///////////////////////////////////////////////////////////////////////////////
+INTEGER ef__DH__generate__private__public__keys (const INTEGER& pl__keyLength, OCTETSTRING& pl__pubkey, OCTETSTRING& pl__privkey)
+{
+  int key_length = (int)pl__keyLength;
+
+  const char* prime_768  = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF";
+
+  const char* prime_1024 = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF";
+
+  const char* prime_2048 = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF";
+
+  DH* dh = DH_new();
+
+  BIGNUM* prime = BN_new();
+  switch(key_length)
+  {
+    case  96: BN_hex2bn(&prime, prime_768);  break;
+    case 128: BN_hex2bn(&prime, prime_1024); break;
+    case 256: BN_hex2bn(&prime, prime_2048); break;
+    default:
+    {
+      DH_free(dh);
+      return INTEGER(0);
+    }
+  }
+  dh->p = prime;
+
+  const char* generator = "2";
+  BIGNUM* gen = BN_new();
+  BN_hex2bn(&gen, generator);
+  dh->g = gen;
+
+  DH_generate_key(dh);
+
+  int pub_len = BN_num_bytes(dh->pub_key);
+  unsigned char* pub_key = (unsigned char*)Malloc(pub_len * sizeof(unsigned char));
+  pub_len = BN_bn2bin(dh->pub_key, pub_key);
+  if (key_length-pub_len > 0)
+  {pl__pubkey =  int2oct(0,key_length-pub_len) + OCTETSTRING(pub_len, pub_key);}
+  else
+  {pl__pubkey =  OCTETSTRING(key_length, pub_key);}
+  Free(pub_key);
+
+  if (pub_len <= 0)
+  {
+      DH_free(dh);
+      return INTEGER(0);
+  }
+
+  int priv_len = BN_num_bytes(dh->priv_key);
+  unsigned char* priv_key = (unsigned char*)Malloc(priv_len * sizeof(unsigned char));
+  priv_len = BN_bn2bin(dh->priv_key, priv_key);
+  if (key_length-priv_len > 0)
+  {pl__privkey =  int2oct(0,key_length-priv_len) + OCTETSTRING(priv_len, priv_key);}
+  else
+  {pl__privkey =  OCTETSTRING(key_length, priv_key);}
+  Free(priv_key);
+
+  if (priv_len <= 0)
+  {
+      DH_free(dh);
+      return INTEGER(0);
+  }
+
+  DH_free(dh);
+  return INTEGER(1);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_DH_shared_secret
+//
+//  Purpose: Calculates the shared secret from the given public and private keys.
+//
+//  Parameters:
+//          pl__pubkey    - *in* *octetstring*   - Public key (other party)
+//          pl__privkey   - *in* *octetstring*   - Private key (this party)
+//
+//  Return Value:
+//         octetstring - DH shared secret
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      Computes the shared secret from the originating side's private key and
+//      the public key of the responding side as described in DH group 1, 2 and 14.
+//      Keys must be either 96, 128 or 256 bytes long.
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING ef__DH__shared__secret (const OCTETSTRING& pl__pubkey, const OCTETSTRING& pl__privkey)
+{
+  int key_length = pl__pubkey.lengthof();
+  unsigned char shared_secret[key_length];
+
+  const char* prime_768  = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF";
+
+  const char* prime_1024 = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF";
+
+  const char* prime_2048 = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF";
+
+  DH* dh = DH_new();
+
+  BIGNUM* prime = BN_new();
+  switch(key_length)
+  {
+    case  96: BN_hex2bn(&prime, prime_768);  break;
+    case 128: BN_hex2bn(&prime, prime_1024); break;
+    case 256: BN_hex2bn(&prime, prime_2048); break;
+    default:
+    {
+      DH_free(dh);
+      return OCTETSTRING(0, NULL);
+    }
+  }
+  dh->p = prime;
+
+  const char* generator = "2";
+  BIGNUM* gen = BN_new();
+  BN_hex2bn(&gen, generator);
+  dh->g = gen;
+
+  BIGNUM* priv_key = BN_new();
+  BN_bin2bn((const unsigned char*)pl__privkey, key_length, priv_key);
+  dh->priv_key = priv_key;
+
+  BIGNUM* pub_key = BN_new();
+  BN_bin2bn((const unsigned char*)pl__pubkey, key_length, pub_key);
+  dh->pub_key = pub_key;
+
+  if(DH_compute_key(shared_secret, pub_key, dh))
+  {
+    DH_free(dh);
+    return OCTETSTRING(key_length, shared_secret);
+  }
+
+  DH_free(dh);
+  return OCTETSTRING(0, NULL);
+
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_AES_ECB_128_Encrypt_OpenSSL
+//
+//  Purpose: Calculate AES 128 ECB encrypted value
+//
+//  Parameters:
+//          p_key       - *in* *octetstring*   - Key
+//          p_data      - *in* *octetstring*   - Data
+//
+//  Return Value:
+//         octetstring - encrypted value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__AES__ECB__128__Encrypt__OpenSSL (const OCTETSTRING& p_key,const OCTETSTRING& p_data)
+{
+  if(p_key.lengthof()!=16){
+    TTCN_error("f_AES_EBC_128_Encrypt_OpenSSL: The length of the key should be 16 instead of %d",p_key.lengthof() );
+  }
+  const unsigned char* data=(const unsigned char*)p_data;
+  int data_len = p_data.lengthof();
+
+  int outbuf_len=data_len+AES_BLOCK_SIZE;
+
+  unsigned char* outbuf=(unsigned char*)Malloc(outbuf_len * sizeof(unsigned char));
+
+  int round=((data_len+AES_BLOCK_SIZE-1)/AES_BLOCK_SIZE)*AES_BLOCK_SIZE;
+
+  AES_KEY aes_k;
+  AES_set_encrypt_key((const unsigned char*)p_key,128,&aes_k);
+
+  for(int i=0;i<round; i++){
+    if((i+1)*AES_BLOCK_SIZE > data_len){  // last partial block
+      unsigned char b[AES_BLOCK_SIZE];
+      memset(b,0,AES_BLOCK_SIZE);
+      memcpy(b,data+(i*AES_BLOCK_SIZE),data_len-(i*AES_BLOCK_SIZE));
+      AES_encrypt(data+(i*AES_BLOCK_SIZE),outbuf+(i*AES_BLOCK_SIZE),&aes_k);
+    } else {  // full block
+      AES_encrypt(data+(i*AES_BLOCK_SIZE),outbuf+(i*AES_BLOCK_SIZE),&aes_k);
+    }
+  }
+
+
+  OCTETSTRING ret_val=OCTETSTRING(data_len,outbuf );
+  return ret_val;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_AES_ECB_128_Decrypt_OpenSSL
+//
+//  Purpose: Calculate AES 128 ECB decrypted value
+//
+//  Parameters:
+//          p_key       - *in* *octetstring*   - Key
+//          p_data      - *in* *octetstring*   - Data
+//
+//  Return Value:
+//         octetstring - encrypted value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+OCTETSTRING f__AES__ECB__128__Decrypt__OpenSSL (const OCTETSTRING& p_key,const OCTETSTRING& p_data)
+{
+  if(p_key.lengthof()!=16){
+    TTCN_error("f_AES_EBC_128_Decrypt_OpenSSL: The length of the key should be 16 instead of %d",p_key.lengthof() );
+  }
+  const unsigned char* data=(const unsigned char*)p_data;
+  int data_len = p_data.lengthof();
+
+  int outbuf_len=data_len+AES_BLOCK_SIZE;
+
+  unsigned char* outbuf=(unsigned char*)Malloc(outbuf_len * sizeof(unsigned char));
+
+  int round=((data_len+AES_BLOCK_SIZE-1)/AES_BLOCK_SIZE)*AES_BLOCK_SIZE;
+
+  AES_KEY aes_k;
+  AES_set_decrypt_key((const unsigned char*)p_key,128,&aes_k);
+
+  for(int i=0;i<round; i++){
+    if((i+1)*AES_BLOCK_SIZE > data_len){  // last partial block
+      unsigned char b[AES_BLOCK_SIZE];
+      memset(b,0,AES_BLOCK_SIZE);
+      memcpy(b,data+(i*AES_BLOCK_SIZE),data_len-(i*AES_BLOCK_SIZE));
+      AES_decrypt(data+(i*AES_BLOCK_SIZE),outbuf+(i*AES_BLOCK_SIZE),&aes_k);
+    } else {  // full block
+      AES_decrypt(data+(i*AES_BLOCK_SIZE),outbuf+(i*AES_BLOCK_SIZE),&aes_k);
+    }
+  }
+
+
+  OCTETSTRING ret_val=OCTETSTRING(data_len,outbuf );
+  return ret_val;
+}
+OCTETSTRING f__AES__CTR__128__Encrypt__Decrypt__OpenSSL (const OCTETSTRING& p_key,const OCTETSTRING& p_iv,const OCTETSTRING& p_data)
+{
+  if(p_key.lengthof()!=16){
+    TTCN_error("f_AES_EBC_128_Decrypt_OpenSSL: The length of the key should be 16 instead of %d",p_key.lengthof() );
+  }
+  if(p_iv.lengthof()!=16){
+    TTCN_error("f_AES_EBC_128_Decrypt_OpenSSL: The length of the IV should be 16 instead of %d",p_iv.lengthof() );
+  }
+  AES_KEY aes_k;
+  AES_set_encrypt_key((const unsigned char*)p_key,128,&aes_k);
+
+  int data_len=p_data.lengthof();
+  unsigned char enc_data[data_len];
+  unsigned char k_iv[AES_BLOCK_SIZE];
+  memcpy(k_iv,(const unsigned char*)p_iv,AES_BLOCK_SIZE);
+
+  unsigned int num = 0;
+  unsigned char ecount_buf[AES_BLOCK_SIZE];
+  memset(ecount_buf, 0, AES_BLOCK_SIZE);
+
+  AES_ctr128_encrypt((const unsigned char*)p_data, enc_data, data_len, &aes_k, k_iv, ecount_buf, &num);
+
+  return OCTETSTRING(data_len, enc_data);
+}
+
+}
diff --git a/src/TCCOpenSecurity_Functions.ttcn b/src/TCCOpenSecurity_Functions.ttcn
new file mode 100644
index 0000000000000000000000000000000000000000..8152cf6203a564fd385395e3a1585c32738460de
--- /dev/null
+++ b/src/TCCOpenSecurity_Functions.ttcn
@@ -0,0 +1,585 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// 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
+///////////////////////////////////////////////////////////////////////////////
+//
+//  File:               TCCOpenSecurity.ttcn
+//  Description:        TCC Useful Functions: Security Functions
+//  Rev:                R30A
+//  Prodnr:             CNL 113 472
+//
+///////////////////////////////////////////////////////////////////////////////
+
+module TCCOpenSecurity_Functions {
+
+type octetstring OCT_16 length(16);
+type octetstring OCT_64 length(64);
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculateRAND_oct
+//
+//  Purpose:
+//    Compute random value
+//
+//  Parameters:
+//      pl_length - *in* *integer* -  length of random value
+//
+//  Return Value:
+//      random value - *out* *octetstring* -  random value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_calculateRAND_oct(in integer pl_length) return octetstring;
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculateSHA1
+//
+//  Purpose:
+//    Compute SHA1 hash value
+//
+//  Parameters:
+//      pszHashInput - *in* *charstring* -  input value to compute SHA1 hash
+//
+//  Return Value:
+//      charstring - hexa hash value of input
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - SHA1() is an openssl specific function, should be found under openssl/sha.h
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_calculateSHA1(in charstring pszHashInput) return charstring;
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculateSHA1_oct
+//
+//  Purpose:
+//    Compute SHA1 hash value, octetstring output
+//
+//  Parameters:
+//      pszHashInput - *in* *charstring* -  input value to compute SHA1 hash
+//
+//  Return Value:
+//      octetstring - octetstring hash value of input
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - SHA1() is an openssl specific function, should be found under openssl/sha.h
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_calculateSHA1_oct(in octetstring pszHashInput) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculateHMACMD5
+//
+//  Purpose:
+//      Calculate the 128 bit HMAC MD5 value of a message with specified 64 bit key.
+//
+//  Parameters:
+//      msg - *in* *octetstring* - message to be hashed
+//      key - *in* *OCT_64*      - 64 bit key of the hash function
+//
+//  Return Value:
+//      octetstring - Hash value (16 octet)
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - key should be 64 bit long, output is 128 bit long
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_calculateHMACMD5(in octetstring msg, in OCT_64 key) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculate_HMAC_MD5
+//
+//  Purpose:
+//      Calculate the HMAC MD5 value of a message with specified key.
+//
+//  Parameters:
+//      pl_key - *in* *octetstring*   - key of the hash function
+//      pl_input - *in* *octetstring* - message to be hashed
+//      pl_length - *in* *integer*    - length of the output hash value (should be 16 in most of the cases)
+//
+//  Return Value:
+//      octetstring - Hash value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - key can be any length
+//      - the length of output can be set in pl_length
+//
+///////////////////////////////////////////////////////////////////////////////
+external function  f_calculate_HMAC_MD5(in octetstring pl_key, in octetstring pl_input, in integer pl_length) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculate_HMAC_SHA1
+//
+//  Purpose:
+//      Calculate the HMAC SHA1 value of a message with specified key.
+//
+//  Parameters:
+//      pl_key - *in* *octetstring*   - key of the hash function
+//      pl_input - *in* *octetstring* - message to be hashed
+//      pl_length - *in* *integer*    - length of the output hash value (should be 16 in most of the cases)
+//
+//  Return Value:
+//      octetstring - Hash value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - key can be any length
+//      - the length of output can be set in pl_length
+//
+///////////////////////////////////////////////////////////////////////////////
+external function  f_calculate_HMAC_SHA1(in octetstring pl_key, in octetstring pl_input, in integer pl_length) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculate_HMAC_SHA256
+//
+//  Purpose:
+//      Calculate the HMAC SHA256 value of a message with specified key.
+//
+//  Parameters:
+//      pl_key - *in* *octetstring*   - key of the hash function
+//      pl_input - *in* *octetstring* - message to be hashed
+//      pl_length - *in* *integer*    - length of the output hash value (should be 32 in most of the cases)
+//
+//  Return Value:
+//      octetstring - Hash value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - key can be any length
+//      - the length of output can be set in pl_length
+//
+///////////////////////////////////////////////////////////////////////////////
+external function  f_calculate_HMAC_SHA256(in octetstring pl_key, in octetstring pl_input, in integer pl_length) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_AES_CBC_128_Encrypt_OpenSSL
+//
+//  Purpose: Calculate AES 128 CBC encrypted value
+//
+//  Parameters:
+//          p_key       - *in* *octetstring*   - Key
+//          p_iv        - *in* *octetstring*   - Initialiazation Vector
+//          p_data      - *in* *octetstring*   - Data
+//
+//  Return Value:
+//         octetstring - encrypted value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_AES_CBC_128_Encrypt_OpenSSL
+(
+  in octetstring p_key,
+  in octetstring p_iv,
+  in octetstring p_data
+) return octetstring;
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_AES_CBC_128_Decrypt_OpenSSL
+//
+//  Purpose: Dectrypts AES 128 CBC encrypted data
+//
+//  Parameters:
+//          p_key       - *in* *octetstring*   - Key
+//          p_iv        - *in* *octetstring*   - Initialiazation Vector
+//          p_data      - *in* *octetstring*   - Encrypted Value
+//
+//  Return Value:
+//         octetstring - decrypted original data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_AES_CBC_128_Decrypt_OpenSSL
+(
+  in octetstring p_key,
+  in octetstring p_iv,
+  in octetstring p_data
+) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_AES_CBC_Encrypt_OpenSSL
+//
+//  Purpose: Calculate AES 128 CBC encrypted value with arbitrary key length
+//
+//  Parameters:
+//          p_key       - *in* *octetstring*   - Key
+//          p_iv        - *in* *octetstring*   - Initialiazation Vector
+//          p_data      - *in* *octetstring*   - Data
+//
+//  Return Value:
+//         octetstring - encrypted value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_AES_CBC_Encrypt_OpenSSL
+(
+    in octetstring p_key,
+    in octetstring p_iv,
+    in octetstring p_data
+) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_AES_CBC_Decrypt_OpenSSL
+//
+//  Purpose: Dectrypts AES CBC encrypted data with arbitrary key length
+//
+//  Parameters:
+//          p_key       - *in* *octetstring*   - Key
+//          p_iv        - *in* *octetstring*   - Initialiazation Vector
+//          p_data      - *in* *octetstring*   - Encrypted Value
+//
+//  Return Value:
+//         octetstring - decrypted original data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_AES_CBC_Decrypt_OpenSSL
+(
+    in octetstring p_key,
+    in octetstring p_iv,
+    in octetstring p_data
+) return octetstring;
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_3DES_ECB_Encrypt
+//
+//  Purpose: Encrypts data using 3DES algorithm in ECB mode.
+//
+//  Parameters:
+//          pl_data      - *in* *octetstring*   - Data to be encrypted
+//          pl_key       - *in* *octetstring*   - Key
+//          pl_use_padding - *in* *boolean*     - control the usage of PKCS padding
+//
+//  Return Value:
+//         octetstring - encrypted data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function ef_3DES_ECB_Encrypt
+(
+    in octetstring pl_data,
+    in octetstring pl_key,
+    in boolean     pl_use_padding:=true
+
+) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_3DES_ECB_Decrypt
+//
+//  Purpose:  Dectrypts 3DES ECB encrypted data.
+//
+//  Parameters:
+//          pl_data      - *in* *octetstring*   - Encrytped data
+//          pl_key       - *in* *octetstring*   - Key
+//          pl_use_padding - *in* *boolean*     - control the usage of PKCS padding
+//
+//  Return Value:
+//         octetstring - decrypted data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function ef_3DES_ECB_Decrypt
+(
+    in octetstring pl_data,
+    in octetstring pl_key,
+    in boolean     pl_use_padding:=true
+) return octetstring;
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_3DES_CBC_Encrypt
+//
+//  Purpose: Encrypts data using TripleDES algorithm in CBC mode.
+//
+//  Parameters:
+//          pl_data      - *in* *octetstring*   - Data to be encrypted
+//          pl_key       - *in* *octetstring*   - Key
+//          pl_iv        - *in* *octetstring*   - Initialiazation Vector
+//          pl_use_padding - *in* *boolean*     - control the usage of PKCS padding
+//
+//  Return Value:
+//         octetstring - decrypted original data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function ef_3DES_CBC_Encrypt
+(
+    in octetstring pl_data,
+    in octetstring pl_key,
+    in octetstring pl_iv,
+    in boolean     pl_use_padding:=true
+
+) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_3DES_CBC_Decrypt
+//
+//  Purpose: Decrypts TripleDES encrypted data.
+//
+//  Parameters:
+//          pl_data       - *in* *octetstring*   - Encrypted Value
+//          pl_key        - *in* *octetstring*   - Key
+//          pl_iv         - *in* *octetstring*   - Initialiazation Vector
+//          pl_use_padding - *in* *boolean*     - control the usage of PKCS padding
+//
+//  Return Value:
+//         octetstring - decrypted original data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function ef_3DES_CBC_Decrypt
+(
+    in octetstring pl_data,
+    in octetstring pl_key,
+    in octetstring pl_iv,
+    in boolean     pl_use_padding:=true
+
+) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_Calculate_AES_XCBC_128
+//
+//  Purpose: Calculates the AES XCBC value of the data with a 128 bit key.
+//
+//  Parameters:
+//          pl_data       - *in* *octetstring*   - Data
+//          pl_key        - *in* *octetstring*   - Key
+//          pl_out_length - *in* *integer*       - Length of the output
+//
+//  Return Value:
+//         octetstring - AES XCBC value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      AES XCBC generates a 16 byte long value which can be truncated
+//      to a length given in pl_out_length.
+//
+///////////////////////////////////////////////////////////////////////////////
+external function ef_Calculate_AES_XCBC_128
+(
+    in octetstring pl_data,
+    in octetstring pl_key,
+    in integer pl_out_length
+) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_DH_generate_private_public_keys
+//
+//  Purpose: Generates public and private keys (this party).
+//
+//  Parameters:
+//          pl_keyLength - *in* *integer*          - Key length (bytes)
+//          pl_pubkey    - *inout* *octetstring*   - Public key (other party)
+//          pl_privkey   - *inout* *octetstring*   - Private key (this party)
+//
+//  Return Value:
+//         integer - 0: failure, 1 success
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      Computes the shared secret from the originating side's private key and
+//      the public key of the responding side as described in DH group 2 and 14.
+//      Keys must be either 96, 128 or 256 bytes long.
+//
+///////////////////////////////////////////////////////////////////////////////
+external function ef_DH_generate_private_public_keys
+(
+    in integer pl_keyLength,
+    inout octetstring pl_pubkey,
+    inout octetstring pl_privkey
+) return integer;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: ef_DH_shared_secret
+//
+//  Purpose: Calculates the shared secret from the given public and private keys.
+//
+//  Parameters:
+//          pl_pubkey      - *in* *octetstring*   - Public key (other party)
+//          pl_privkey     - *in* *octetstring*   - Private key (this party)
+//
+//  Return Value:
+//         octetstring - DH shared secret
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      Computes the shared secret from the originating side's private key and
+//      the public key of the responding side as described in DH group 1, 2 and 14.
+//      Keys must be either 96, 128 or 256 bytes long.
+//
+///////////////////////////////////////////////////////////////////////////////
+external function ef_DH_shared_secret
+(
+    in octetstring pl_pubkey,
+    in octetstring pl_privkey
+) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_AES_ECB_128_Encrypt_OpenSSL
+//
+//  Purpose: Calculate AES 128 ECB encrypted value
+//
+//  Parameters:
+//          p_key       - *in* *octetstring*   - Key
+//          p_data      - *in* *octetstring*   - Data
+//
+//  Return Value:
+//         octetstring - encrypted value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_AES_ECB_128_Encrypt_OpenSSL
+(
+  OCT_16 p_key,
+  octetstring p_data
+) return octetstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_AES_ECB_128_Decrypt_OpenSSL
+//
+//  Purpose: Dectrypts AES 128 EBC encrypted data
+//
+//  Parameters:
+//          p_key       - *in* *octetstring*   - Key
+//          p_data      - *in* *octetstring*   - Encrypted Value
+//
+//  Return Value:
+//         octetstring - decrypted original data
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_AES_ECB_128_Decrypt_OpenSSL
+(
+  OCT_16 p_key,
+  octetstring p_data
+) return octetstring;
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_AES_CTR_128_Encrypt_Decrypt_OpenSSL
+//
+//  Purpose: Calculate AES 128 CTR encrypted value
+//
+//  Parameters:
+//          p_key       - *in* *octetstring*   - Key
+//          p_iv        - *in* *octetstring*   - Initialiazation Vector (IV+counter)
+//          p_data      - *in* *octetstring*   - Data
+//
+//  Return Value:
+//         octetstring - encrypted value
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_AES_CTR_128_Encrypt_Decrypt_OpenSSL
+(
+  OCT_16 p_key,
+  OCT_16 p_iv,
+  octetstring p_data
+) return octetstring;
+
+
+
+}
diff --git a/src/TCCPermutatedParameters_Definitions.ttcn b/src/TCCPermutatedParameters_Definitions.ttcn
index 5199ff0d5e88288eca8ecadb2c7bf8dc281968cc..6c81a0fecf8a08cdd11dc58f6fe0a4893a93f34d 100644
--- a/src/TCCPermutatedParameters_Definitions.ttcn
+++ b/src/TCCPermutatedParameters_Definitions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2013                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCPermutatedParameters_Definitions.ttcn
 //  Description:        definitions for permutated params
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2013-05-30
-//  Contact:            http://ttcn.ericsson.se
 //////////////////////////////////////////////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -159,4 +156,4 @@ type record of PP_ParamSet PP_ParamSetList; // is each CGPN has its own current
 ///////////////////////////////////////////////////////////
 type set of PP_SingleParam PP_ParamSet;  // ie params belonging to one particular call
 
-} with { extension "version R25A"}
+} with { extension "version R30A"}
diff --git a/src/TCCPermutatedParameters_Functions.ttcn b/src/TCCPermutatedParameters_Functions.ttcn
index 092e4df97f8af9e63adf0fc1473714b6ba4d7e2b..a009dec18d45e5050d05e624543524bfa554a75b 100644
--- a/src/TCCPermutatedParameters_Functions.ttcn
+++ b/src/TCCPermutatedParameters_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2013                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCPermutatedParameters_Functions.ttcn
 //  Description:        functions for permutated params
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2013-07-17
-//  Contact:            http://ttcn.ericsson.se
 //////////////////////////////////////////////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -908,4 +905,4 @@ public function f_PP_getParamValueFromSet(
   return vl_ret;
 }
 
-} with { extension "version R25A"}
+} with { extension "version R30A"}
diff --git a/src/TCCRegexp.cc b/src/TCCRegexp.cc
index 96cae5c1634bd0df30efe07de6b44514bfe3b940..3b70154ba674e62fdeb491fba65b337aa0b16235 100644
--- a/src/TCCRegexp.cc
+++ b/src/TCCRegexp.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2009                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCRegexp_Functions.ttcn
 //  Description:        TCC Useful Functions: Regexp Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2009-11-20
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -24,7 +21,7 @@
 namespace TCCRegexp__Functions{
   CHARSTRING f__pcre__regexp(const CHARSTRING& instr,
           const CHARSTRING& expression, const INTEGER& groupno ){
-    
+
     pcre *re;
     const char *error_text;
     int erroroffset;
@@ -36,7 +33,7 @@ namespace TCCRegexp__Functions{
     }
     int rc;
     int max_groupno;
-    
+
     rc=pcre_fullinfo(re,NULL,PCRE_INFO_CAPTURECOUNT,&max_groupno);
     if(rc!=0){
       TTCN_error("pcre_fullinfo failed. Error code: %d",rc);
@@ -44,7 +41,7 @@ namespace TCCRegexp__Functions{
     max_groupno=(max_groupno+1)*3;
     int *ovector = (int*)Malloc(max_groupno*sizeof(int));
     rc = pcre_exec(re,NULL,instr,instr.lengthof(),0,0,ovector,max_groupno);
-    
+
     CHARSTRING ret_val;
     if(rc<=groupno){ ret_val="";}
     else if( ovector[groupno*2] == -1 ) { ret_val="";}
@@ -57,7 +54,7 @@ namespace TCCRegexp__Functions{
 
   charstring__list f__pcre__regexp__list(const CHARSTRING& instr,
           const CHARSTRING& expression){
-    
+
     pcre *re;
     const char *error_text;
     int erroroffset;
@@ -69,7 +66,7 @@ namespace TCCRegexp__Functions{
     }
     int rc;
     int max_groupno;
-    
+
     rc=pcre_fullinfo(re,NULL,PCRE_INFO_CAPTURECOUNT,&max_groupno);
     if(rc!=0){
       TTCN_error("pcre_fullinfo failed. Error code: %d",rc);
@@ -77,7 +74,7 @@ namespace TCCRegexp__Functions{
     int ovecsivze=(max_groupno+1)*3;
     int *ovector = (int*)Malloc(ovecsivze*sizeof(int));
     rc = pcre_exec(re,NULL,instr,instr.lengthof(),0,0,ovector,ovecsivze);
-    
+
     charstring__list ret_val;
     for(int a=0;a<=max_groupno;a++){
       if(rc<=a){ ret_val[a]="";}
@@ -90,4 +87,48 @@ namespace TCCRegexp__Functions{
     return ret_val;
   }
 
+  t__list__of__charstring__list
+  f__pcre__regexp__list__all__matches(const CHARSTRING& instr,
+          const CHARSTRING& expression){
+
+    pcre *re;
+    const char *error_text;
+    int erroroffset;
+    re = pcre_compile(expression,0,&error_text,&erroroffset,NULL);
+    if(re == NULL){
+      TTCN_error("Compilation of the pcre regexp failled at position %d."
+                 "Reason: \"%s\"",erroroffset,error_text);
+      return NULL_VALUE;
+    }
+    int rc;
+    int max_groupno;
+
+    rc=pcre_fullinfo(re,NULL,PCRE_INFO_CAPTURECOUNT,&max_groupno);
+    if(rc!=0){
+      TTCN_error("pcre_fullinfo failed. Error code: %d",rc);
+    }
+    int ovecsivze=(max_groupno+1)*3;
+    int *ovector = (int*)Malloc(ovecsivze*sizeof(int));
+    int ln = instr.lengthof();
+    int offset = 0;
+    t__list__of__charstring__list ret_val =
+        t__list__of__charstring__list(null_type());
+
+    while (offset < ln &&
+      (rc = pcre_exec(re,NULL,instr,ln,offset,0,ovector,ovecsivze)) >= 0)
+    {
+      charstring__list match;
+      for(int a=0;a<=max_groupno;a++){
+        if(rc<=a){ match[a]="";}
+        else if( ovector[a*2] == -1 ) { match[a]="";}
+        else {
+          match[a]=substr(instr, ovector[a*2], ovector[(a*2)+1]- ovector[a*2]);
+        }
+      }
+      ret_val[ret_val.size_of()] = match;
+      offset = ovector[1];
+    }
+    Free(ovector);
+    return ret_val;
+  }
 }
diff --git a/src/TCCRegexp_Functions.ttcn b/src/TCCRegexp_Functions.ttcn
index 3fa2df09839aa855f6bd90f93939e8fa0b353666..325b28bfcf1f346815d13ad991a5ab98b4a6cc73 100644
--- a/src/TCCRegexp_Functions.ttcn
+++ b/src/TCCRegexp_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2009                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCRegexp_Functions.ttcn
 //  Description:        TCC Useful Functions: Regexp Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2009-11-20
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -105,4 +102,35 @@ module TCCRegexp_Functions{
   external function f_pcre_regexp_list(in charstring instr, 
                                in charstring expression) return charstring_list;
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_pcre_regexp_list_all_matches
+//
+//  Purpose:
+//    Evaulate a Perl compatible regular expression
+//
+//  Parameters:
+//      instr - *in* *charstring* -   string to be matched
+//      expression - *in* *charstring* -  the pattern
+//
+//  Return Value:
+//    record of charstring_list - the matched substrings
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    This function returns the full list of the substring of the input
+//    character string instr, which is the content of n-th group matching
+//    to the expression. The expression is a Perl compatible regular expression
+//    pattern. Group numbers are assigned by the order of occurrences of the
+//    opening bracket of a group and counted starting from 1 by step 1. If no
+//    substring fulfilling all conditions is found within the input string,
+//    an empty record of is returned.
+//
+///////////////////////////////////////////////////////////////////////////////
+  type record of charstring_list t_list_of_charstring_list;
+
+  external function f_pcre_regexp_list_all_matches(in charstring instr,
+                     in charstring expression) return t_list_of_charstring_list;
+
 }
diff --git a/src/TCCSystem.cc b/src/TCCSystem.cc
index 6e6b246aca690cb345a99990dcc44a6a36ab039d..cd600c7b15d1184bbc8cf10cec0846a5823a0e2e 100644
--- a/src/TCCSystem.cc
+++ b/src/TCCSystem.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2009                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCSystem.cc
 //  Description:        TCC Useful Functions: System Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2009-04-10
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 #include "TCCSystem_Functions.hh"
diff --git a/src/TCCSystem_Functions.ttcn b/src/TCCSystem_Functions.ttcn
index 82f925c376115f55af31113c42528975c2893408..d7c3bfd8722f81358c2d334918efd3a93fa4e360 100644
--- a/src/TCCSystem_Functions.ttcn
+++ b/src/TCCSystem_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2009                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCSystem_Functions.ttcn
 //  Description:        TCC Useful Functions: System Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2009-04-10
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCTemplate_Functions.ttcn b/src/TCCTemplate_Functions.ttcn
index ed604a90c624d6b49ab114400754c7e7fe91f1b7..f1a77a96456bfe9a0a2b2bc035eb7cc67e320d41 100644
--- a/src/TCCTemplate_Functions.ttcn
+++ b/src/TCCTemplate_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2007                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCTemplate_Functions.ttcn
 //  Description:        TCC Useful Functions: Template Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2007-12-20
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCTitanMetadata.cc b/src/TCCTitanMetadata.cc
index cdec76571d26e7bbf22102757e8ea5407627c6dc..abb20073d88d494d279a962e4d2c67209ade5ac8 100644
--- a/src/TCCTitanMetadata.cc
+++ b/src/TCCTitanMetadata.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2007                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCTitanMetadata.cc
 //  Description:        TCC Useful Functions: TitanMetadata Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2007-10-26
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCTitanMetadata_Functions.ttcn b/src/TCCTitanMetadata_Functions.ttcn
index 723c70aaf69659f974b41c2d3bcde3bd8ce7d406..decbb9f60b9bb8bf1594d8544557cdba99cf9656 100644
--- a/src/TCCTitanMetadata_Functions.ttcn
+++ b/src/TCCTitanMetadata_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2007                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCTitanMetadata_Functions.ttcn
 //  Description:        TCC Useful Functions: TitanMetadata Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2007-10-26
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCUsefulFunctions_Library.grp b/src/TCCUsefulFunctions_Library.grp
index a75bf7ec0b05a7d3c5d4b0bdafc01539387b8abf..5fc46e2bfe7d44085e3620eb3c17a25399d112fd 100644
--- a/src/TCCUsefulFunctions_Library.grp
+++ b/src/TCCUsefulFunctions_Library.grp
@@ -1,21 +1,18 @@
 <!--
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2012                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) has been supplied.          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:        TCCUsefulFunctions_Library.grp
 //  Description: FileGroup file for TCCUsefulFunctions ApplicationLibrary
-//  Rev:         R25A
+//  Rev:         R30A
 //  Prodnr:      CNL 113 472
-//  Updated:     2012-03-26
-//  Contact:     http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 -->
@@ -38,6 +35,11 @@
     <File path="TCCIPsec.cc" />
     <File path="TCCIPsec_Definitions.ttcn" />
     <File path="TCCIPsec_Functions.ttcn" />
+    <File path="TCCIPsec_XFRM.cc" />
+    <File path="TCCIPsec_XFRM.hh" />
+    <File path="TCCIPsec_XFRM_Definitions.ttcn" />
+    <File path="TCCIPsec_XFRM_SA.cc" />
+    <File path="TCCIPsec_XFRM_SP.cc" />
     <File path="TCCInterface.cc" />
     <File path="TCCInterface_Functions.ttcn" />
     <File path="TCCInterface_ip.h" />
diff --git a/src/TCCUsefulFunctions_PermutatedParameters.grp b/src/TCCUsefulFunctions_PermutatedParameters.grp
index e8329ac01c575ae46c4cbde881ad5e3f0254106f..597c32db95bd540cbc3135a6ceb625957b4cbddb 100644
--- a/src/TCCUsefulFunctions_PermutatedParameters.grp
+++ b/src/TCCUsefulFunctions_PermutatedParameters.grp
@@ -1,21 +1,18 @@
 <!--
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2013                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) has been supplied.          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:        TCCUsefulFunctions_PermutatedParameters.grp
 //  Description: FileGroup file for TCCUsefulFunctions Permutated Parameters
-//  Rev:         R25A
+//  Rev:         R30A
 //  Prodnr:      CNL 113 472
-//  Updated:     2013-05-30
-//  Contact:     http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 -->
diff --git a/src/TCCXPathSupport.cc b/src/TCCXPathSupport.cc
index 1df4da0b9f38ea0f93498f9eab697a6686805947..17058ff699b9b5501be361c3c3326b8cf425ee7e 100644
--- a/src/TCCXPathSupport.cc
+++ b/src/TCCXPathSupport.cc
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2008                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCXPathSupport_Functions.ttcn
 //  Description:        TCC Useful Functions: XPath Support Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2008-08-26
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/TCCXPathSupport_Functions.ttcn b/src/TCCXPathSupport_Functions.ttcn
index 895ad2dfbd4110904031b0314da3f82925b07cfd..1bc99e7ca19945db2d4fc9c076cafacc1039ff1b 100644
--- a/src/TCCXPathSupport_Functions.ttcn
+++ b/src/TCCXPathSupport_Functions.ttcn
@@ -1,20 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// Copyright Test Competence Center (TCC) ETH 2008                           //
-//                                                                           //
-// The copyright to the computer  program(s) herein  is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with  the terms and conditions  stipulated in the //
-// agreement/contract under which the program(s) have been supplied          //
-//                                                                           //
+//
+// 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
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCXPathSupport_Functions.ttcn
 //  Description:        TCC Useful Functions: XPath Support Functions
-//  Rev:                R25A
+//  Rev:                R30A
 //  Prodnr:             CNL 113 472
-//  Updated:            2008-08-26
-//  Contact:            http://ttcn.ericsson.se
 //
 ///////////////////////////////////////////////////////////////////////////////