diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000000000000000000000000000000000..37850d3ced33a34d2971ea73c485f532121a6aa8
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,19 @@
+[submodule "titan-test-system-framework"]
+ path = titan-test-system-framework
+ url = https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git
+ branch = devel
+[submodule "ttcn/LibCommon"]
+ path = ttcn/LibCommon
+ url = https://forge.etsi.org/rep/LIBS/LibCommon.git
+[submodule "ttcn/LibDiameter"]
+ path = ttcn/LibDiameter
+ url = https://forge.etsi.org/rep/LIBS/LibDiameter.git
+[submodule "ttcn/LibIms"]
+ path = ttcn/LibIms
+ url = https://forge.etsi.org/rep/LIBS/LibIms.git
+[submodule "ttcn/LibSip"]
+ path = ttcn/LibSip
+ url = https://forge.etsi.org/rep/LIBS/LibSip.git
+[submodule "ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module"]
+ path = ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module
+ url = https://gitlab.eclipse.org/eclipse/titan/titan.TestPorts.Common_Components.Abstract_Socket
diff --git a/LICENSE b/LICENSE
index 0ce64ae6f07cce145f2221b34333ee4f0f1c2b03..13b111abd420afebce806ea90be8d56045f81d4d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,23 +1,23 @@
-Copyright 2025 ETSI
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-3. Neither the name of the copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-OF THE POSSIBILITY OF SUCH DAMAGE.
+Copyright 2019-2025 ETSI
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+3. Neither the name of the copyright holder nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..14dfd4d5079d8c5e09d3163c138f22115ff79fbb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,142 @@
+-include config.mk
+
+ifeq (,$(ATS))
+ $(error ATS shall be defined)
+endif
+
+ifeq (,$(TOPDIR))
+ TOPDIR := .
+endif
+
+ifeq (,$(TTCN3_DIR))
+ $(error TTCN3_DIR shall be defined in config.mk)
+endif
+
+first: all
+
+define IncludeModule
+undefine sources
+undefine modules
+undefine includes
+include $(1)/module.mk
+$$(foreach S, $$(sources), $$(eval all_sources += $$(if $$(filter /%, $$(S)), $$(TOPDIR)$$(S), $(1)/$$(S))))
+$$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(TOPDIR)$$(I), $(1)/$$(I))))
+$$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)$$(M), $(1)/$$(M)))))
+endef
+
+all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2
+defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL _GNU_SOURCE
+libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs
+
+ifeq (Windows_NT,$(OS))
+# Silence linker warnings.
+LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc
+defines += WIN32
+libs += $(patsubst %, -L%/lib, $(OPENSSL_DIR))
+all_includes += $(addsuffix /include, $(OPENSSL_DIR))
+libs += $(WPCAP_DLL_PATH)
+else
+defines += LINUX
+libs += -lpcap -lrt -lpthread
+endif
+
+libs += -lssl -lcrypto -lxml2 -ljsoncpp -L$(OSIP_LIB) -losipparser2 -lsctp
+
+$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS)))
+
+outdir := $(TOPDIR)/build/$(ATS)
+bindir := $(TOPDIR)/bin
+
+sources := $(all_sources)
+includes := $(outdir) $(outdir)/.. $(outdir)/asn1 $(all_includes) $(NPCAP_INCLUDE) $(OSIP_INCLUDE)
+
+ifeq (Windows_NT,$(OS))
+ EXE=.exe
+endif
+
+ttcn_sources := $(filter %.ttcn , $(sources))
+ttcn3_sources := $(filter %.ttcn3, $(sources))
+asn_sources := $(filter %.asn, $(sources))
+asn1_sources := $(filter %.asn1, $(sources))
+xsd_sources := $(filter %.xsd, $(sources))
+
+tt_sources := $(ttcn_sources) $(ttcn3_sources) $(xsd_sources) $(asn_sources) $(asn1_sources)
+cc_sources := $(filter %.cc, $(sources))
+
+gen_ttcn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.cc, $(ttcn_sources))))
+gen_ttcn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.hh, $(ttcn_sources))))
+gen_ttcn3_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.cc, $(ttcn3_sources))))
+gen_ttcn3_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.hh, $(ttcn3_sources))))
+gen_asn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.cc, $(asn_sources))))
+gen_asn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.hh, $(asn_sources))))
+gen_asn1_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.cc, $(asn1_sources))))
+gen_asn1_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.hh, $(asn1_sources))))
+gen_xsd_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.xsd, %.cc, $(xsd_sources))))
+gen_xsd_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.xsd, %.hh, $(xsd_sources))))
+
+gen_sources := $(gen_ttcn_sources) $(gen_ttcn3_sources) $(gen_xsd_sources) $(gen_asn_sources) $(gen_asn1_sources)
+gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_headers) $(gen_xsd_headers) $(gen_asn_headers) $(gen_asn1_headers)
+
+gen_objects := $(patsubst %.cc, %.o, $(gen_sources))
+cc_objects := $(patsubst %.cc, $(outdir)/%.o, $(cc_sources))
+
+.PHONY: all FORCE echo
+
+all: $(bindir) $(outdir) $(bindir)/$(ATS)$(EXE)
+
+echo_sources:
+ @echo -e "$(addsuffix \n,$(all_sources))"
+
+echo: echo_sources
+ @echo -e "sources:\n $(addsuffix \n, $(sources))"
+ @echo -e "gen_sources:\n $(addsuffix \n, $(gen_sources))"
+ @echo -e "gen_objects:\n $(addsuffix \n, $(gen_objects))"
+ @echo -e "cc_objects:\n $(addsuffix \n, $(cc_objects))"
+ @echo -e "includes:\n $(addsuffix \n, $(includes))"
+ @echo -e "defines: $(addsuffix \n, $(defines))"
+
+clean:
+ rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate
+
+regen: force_regen $(outdir)/.generate
+force_regen:
+ rm -f $(outdir)/.generate
+
+t3q: all
+ @echo -e "Code checking in progress..."
+ @java -Xmx3g -Xss512m -jar $(T3Q_PATH)/t3q.jar --config $(T3Q_PATH)/$(T3Q_CONFIG) $(tt_sources) > $(outdir)/t3q.out 2>&1 ; cd -
+ @echo -e "Code checking in done..."
+ @echo -e "Output file is located here: $(outdir)/t3q.out"
+
+t3d: all
+ @echo -e "TTCN-3 doc generation in progress..."
+ @java -Xmx3g -Xss512m -jar $(T3D_PATH)/t3d.jar --config $(T3D_PATH)/$(T3D_CONFIG) $(tt_sources) > $(outdir)/t3d.out 2>&1 ; cd -
+ @echo -e "TTCN-3 doc generation done..."
+ @echo -e "Output file is located here: $(outdir)/t3d.out"
+
+$(outdir) $(outdir)/asn1 $(bindir):
+ mkdir -p $@
+
+$(bindir)/$(ATS)$(EXE): $(gen_objects) $(cc_objects)
+ g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(libs)
+
+$(gen_objects) :%.o :%.cc
+ g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $<
+
+$(cc_objects) : $(outdir)/%.o : %.cc
+ mkdir -p $(dir $@)
+ g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $<
+
+#$(gen_sources):
+# $(TTCN3_DIR)/bin/asn1_compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources)
+
+$(gen_sources): $(outdir)/.generate
+
+$(outdir)/.generate: Makefile $(tt_sources)
+ $(TTCN3_DIR)/bin/compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources)
+ touch $@
+
+$(foreach S, $(ttcn_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc, $(S))): $(S)))
+$(foreach S, $(ttcn3_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn3, %.cc, $(S))): $(S)))
+$(foreach S, $(asn1_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn1, %.cc, $(S))): $(S)))
+$(foreach S, $(asn_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn, %.cc, $(S))): $(S)))
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..802707fa69ddc9537960dfd6ce464c04775fd211
--- /dev/null
+++ b/README.md
@@ -0,0 +1,339 @@
+# Voice and Video over 5G/Emergency VoNR Interoperability Tests
+
+## Introduction
+This repositories contains the test specifications and test adapter code
+for interoprability tests to ETSI TS 103 796-2 (Core Network and Interoperability Testing (INT); Network Interoperability Test Description for emergency services over 5G; (3GPP™ Release 16); Part 2: Test Descriptions).
+
+## Contact information
+Email at cti_support at etsi dot org
+
+## License
+The content of this repository and the files contained are released under the BSD-3-Clause License.
+See the attached LICENSE file or visit
+https://forge.etsi.org/legal-matters
+
+## Standard links
+- ETSI TS 103 796-1: "Core Network and Interoperability Testing (INT); Network Interoperability Test Description for emergency services over 5G; (3GPP™ Release 16); Part 1: Test Purposes (TP)".
+- ETSI TS 124 229: "Digital cellular telecommunications system (Phase 2+) (GSM); Universal Mobile Telecommunications System (UMTS); LTE; 5G; IP multimedia call control protocol based on Session Initiation Protocol (SIP) and Session Description Protocol (SDP); Stage 3 (3GPP TS 24.229 Release 16)".
+- ETSI TS 129 165: "Digital cellular telecommunications system (Phase 2+) (GSM); Universal Mobile Telecommunications System (UMTS); LTE; 5G; Inter-IMS Network to Network Interface (NNI) (3GPP TS 29.165 Release 16)".
+- ETSI TS 129 228: "Digital cellular telecommunications system (Phase 2+) (GSM); Universal Mobile Telecommunications System (UMTS); LTE; IP Multimedia (IM) Subsystem Cx and Dx Interfaces; Signalling flows and message contents (3GPP TS 29.228 Release 16)".
+- ETSI TS 129 229: "Digital cellular telecommunications system (Phase 2+) (GSM); Universal Mobile Telecommunications System (UMTS); LTE; Cx and Dx interfaces based on the Diameter protocol; Protocol details (3GPP TS 29.229 Release 16)".
+
+
+## RFC links
+- IETF RFC 3261: "SIP: Session Initiation Protocol"
+- IETF RFC 7090: "Public Safety Answering Point (PSAP) Callback".
+- IETF RFC 5031: "A Uniform Resource Name (URN) for Emergency and Other Well-Known Services".
+- IETF RFC 8147: "Next-Generation Pan-European eCall"
+
+
+NOTE All draft can be found in the 'IETF XML Registry', accessible [here](https://www.iana.org/assignments/xml-registry/xml-registry.xhtml)
+
+# Installation
+
+The ETSI Emergency VoNR Interoperability Tests project builds and tests regularly on the following platforms:
+
+ - Linux (Ubuntu)
+
+Note: The [OpenSSL](https://www.openssl.org) version > 1.1.x is also required.
+
+## How to do it?
+
+They are two different methods:
+- Using [Vagrant](https://www.vagrantup.com/)
+- Using [Docker](https://www.docker.com/)
+
+How to choose one of these methods is depending of your host system.
+
+NOTE: In all case, if you want to setup an continuous integration process (e.g. Jenkins), Docker is the best choice.
+
+
+### The host system is Windows
+The both methods require a virtual machine. You can use either VirtualBox or WMware.
+In this case, the easiest way is to use Vagrant.
+
+
+### The host system is Linux
+Vagrant requires a virtual machine. You can use either VirtualBox or WMware.
+Docker does not need a virtual machine, so it is the more efficant way.
+
+
+## Using TITAN compiler on a Docker image
+
+In this configuration, TITAN compiler is located on a Docker image and the sources and the outputs are located on the host.
+
+Pre-requisites on your host machine:
+- Install Docker
+
+Procedure on the host machine:
+- Open a Terminal
+- Clone the ETSI Emergency VoNR Interoperability Test System
+- From the ETSI Emergency VoNR Interoperability Test System root directory, build the Docker image executing the following commands:
+
+```sh
+$ cd ./virtualization/docker
+$ docker build --no-cache --tag alpine-emergency-5g-iop -f Dockerfile --force-rm .
+$ docker images
+```
+
+To build the Emergency VoNRE Interoperability Test Suite, execute the following command:
+
+```sh
+$ ./docker-run.sh build
+```
+
+Possble other options are 'clean' to remove all the build outputs or 'rebuild' to force a build of the Test Suite after a 'clean'.
+
+To retrieve the list of the available test cases, execute the following command:
+
+```sh
+$ ./docker-run.sh list
+```
+
+Before to execute the Emergency VoNR Interoperability Test Suite, prepare, edit and update the configuration file:
+
+```sh
+$ ln -sf ../../etc/AtsXxx/AtsXxx_yyy.cf_ ../../etc/AtsXxx/AtsXxx.cfg
+$ vi ../../etc/AtsXxx/AtsXxx.cfg # To update it
+```
+
+To execute the Emergency VoNR Interoperability Test Suite, execute the following command:
+
+```sh
+$ ./docker-run.sh run
+```
+
+Notes:
+- The Emergency VoNR interoperability Test System is listening on port 443
+- Updating the file etc/AtsXxx/AtsXxx.cfg is about (e.g. etc/AtsBCF/AtsBCF.cfg):
+. Selecting the test(s) to be executed
+. Updating value of PICs and PIXITs
+. Updating HTTP port setting
+
+## Using development Docker image
+
+In this configuration, the TITAN compiler, the sources and the outputs are located on the Docker image.
+
+Pre-requisites on your host machine:
+- Install Docker
+
+Procedure for a Windows host machine:
+- On your host machine, open a the Docker Quickstart Terminal
+- On your host machine, clone the ETSI EEmergency Communications project. NOTE that only Docker folder and .jenkins.sh script file are required
+- From the ETSI Emergency VoNR Interoperability Tests project root directory, execute the following commands:
+
+```sh
+$ ./.jenkins.sh
+...
+```
+
+NOTE The creation and the installations will take some time to achieve
+- Start the container
+
+```sh
+$ ./docker/run-container.sh
+...
+```
+
+- Switch to the next clause (Usage)
+
+
+## Using Vagrant
+
+Pre-requisites on your host machine:
+- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html)
+- Install [Vagrant](https://www.vagrantup.com/intro/getting-started/)
+- Install Vagrant plugin vagrant-vbguest
+- Credentials to access [ETSI forge](https://forge.etsi.org/gitlab/users/sign_in)
+ - Set the environment variable USERNAME to your ETSI EOL account user name
+ - Set the environment variable PASSWORD to your ETSI EOL account password
+
+Procedure:
+- On your host machine, open a command line session (PuTTY, DOS window...)
+- From the ETSI Emergency VoNR Interoperability Tests project, clone the Vagrant folder
+- In the file Vagrantfile, modify the tag config.vm.provision replacing & strings by your ETSI credentials
+- In the Vagrant folder, execute the following commands:
+
+```sh
+$ vagrant up --provider virtualbox --provision
+...
+```
+
+NOTE The creation and the installations will take some time to achieve
+- Stop vagrant virtual machine
+
+```sh
+$ vagrant halt
+...
+```
+
+- Update the file 'Vagrantfile' to match with your networks configuration
+- Re-start the vagrant virtual machine and log to to the machine
+
+```sh
+$ vagrant up
+...
+$ vagrant ssh
+```
+
+- Switch to the next clause (Usage)
+
+NOTE The user password is vagrant.
+
+
+## From scratch
+
+Pre-requisites:
+- Install Virtualbox
+
+Procedure:
+- Install a new Linux Virtual machine (Mint, Debian...)
+- Update your system with the latest version of kernel and security packages
+- Install the following packages (According to the Linux chosen, the package naming can be different)
+ autoconf
+ bison
+ build-essential
+ cmake
+ curl
+ dos2unix
+ doxygen
+ emacs
+ expect
+ flex
+ g++:latest
+ gcc:latest
+ graphviz
+ gdb
+ git-core
+ gnutls-bin
+ libglib2.0-dev
+ libpcap-dev
+ libgcrypt-dev
+ libncurses5-dev
+ libssl-dev
+ libtool-bin
+ libtool
+ libwireshark-dev
+ libxml2-dev
+ lsof
+ ntp
+ pkg-config
+ qt5-default
+ qtmultimedia5-dev
+ libqt5svg5-dev
+ subversion
+ sudo
+ sshpass
+ tcpdump
+ texlive-font-utils
+ tshark
+ valgrind
+ vim
+ vsftpd
+ xutils-dev
+ tree
+ tzdata
+ unzip
+ wget
+ xsltproc
+- In your home directory, create the following folders:
+ - $HOME/frameworks,
+ - $HOME/dev
+ - $HOME/lib
+
+- In $HOME/frameworks, build the following package:
+ - Eclipse IDE for C/C++ Developers, according the procedure specified [here](https://www.eclipse.org/cdt/)
+ - TITAN, according the procedure specified [here](https://github.com/eclipse/titan.core)
+ - Import the TITAN plugin into your Eclipse IDE, according the procedure specified [here](https://github.com/eclipse/titan.core)
+
+- Install LibOSIP framework
+```sh
+$ cd ${HOME}/frameworks
+$ git clone https://git.savannah.gnu.org/git/osip.git ./osip
+$ cd osip
+$ ./autogen.sh
+$ ./configure --prefix=/home/etsi
+$ make && make install
+```
+
+- Clone the ETSI Emergency VoNR Interoperability Tests project into $HOME/dev folder
+
+```sh
+$ git clone --recurse-submodules --branch devel https://forge.etsi.org/rep/int/vx5g/emergency-5g-iop.git
+```
+
+- Apply patches
+```sh
+$ cd /home/etsi/dev/emergency-5g-iop/
+$ ./install.sh
+```
+
+- Update your default environment with the content of the script $HOME/dev/emergency-5g-iop/scripts/devenv.bash.ubuntu
+
+- Switch to the next clause (Usage)
+
+
+# Generate certificates for TLS and Emergency VoNR Interoperability security support
+
+This clause describes how generate certificates desrived from Let's encrypt certificate. These certificate will be used for TS mutual authentication.
+NOTE:
+- Certficates shall be renewed every 3 months
+- The port 80 shall be vailable for standalone validation
+
+Pre-requisites:
+- You need to install python and [certbot](https://manpages.ubuntu.com/manpages/impish/en/man1/certbot.1.html).
+
+To generate certifcates, execute the following command:
+
+```sh
+$ export REQUESTS_CA_BUNDLE=$(dirname `python -c "import certifi; print(certifi.where())"`)
+$ mkdir -p $HOME/var/ssl
+$ sudo certbot certonly --debug --emergency-5g-iop-tls-cert --config-dir $HOME/var/ssl --work-dir $HOME/var/ssl --logs-dir $HOME/var/ssl --standalone --agree-tos --email -d -w $HOME/var/ssl/
+```
+
+NOTE: For testing certificate generation and renewal, use the certbot's --dry-run option.
+
+
+# Usage
+
+This clause describes how to compile and execute an Abstract Test Suite.
+The procedures below illustrate how to run the CAM test suite. The same procedures will apply for any other ETSI Emergency Communications test suite.
+
+
+Pre-requisites:
+- Your machine is installed following one of the installation method describes in the previous clause
+- Your are logged as 'etsi' or 'vagrant' user
+
+Procedure in TITAN command line:
+- Open several SSH session (PuTTY...)
+- Change to the directory ~/dev/emergency-5g-iop/
+- Build the test suite you want to exectue (e.g. LIS test suite)
+
+```sh
+$ cd ~/dev/emergency-5g-iop/
+$ export ATS=AtsImsIot
+$ make
+...
+```
+
+- Edit the file ../etc/AtsImsIot/AtsImsIot.cfg
+- Update the following fields:
+ - system.httpPort.params
+ - system.SIPP.params
+ - system.DIAMETER.params
+
+- To run the test suitem, execute the following command:
+
+```sh
+$ cd ~/dev/emergency-5g-iop/scripts
+$ ./run-all.bash
+...
+```
+
+- The log files are located in ../logs/AtsImsIot folder. You can edit them using any editor or using the Eclipse TITAN log plugins
+
+
+# How to Report a Bug
+
+The ETSI Emergency VoNR Interoperability Tests project is under constant development, so it is possible that you will
+encounter a bug while using it. Please report bugs at cti_support at etsi dot org.
diff --git a/ccsrc/EncDec/LibDiameter/LibDiameter_EncDec.cc b/ccsrc/EncDec/LibDiameter/LibDiameter_EncDec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..293adee1af946fd4726e84053e8db410a45db041
--- /dev/null
+++ b/ccsrc/EncDec/LibDiameter/LibDiameter_EncDec.cc
@@ -0,0 +1,927 @@
+
+#include "LibDiameter_EncdecDeclarations.hh"
+
+#include "loggers.hh"
+
+#include "diameter_aar_codec.hh"
+#include "diameter_uar_codec.hh"
+
+namespace LibDiameter__EncdecDeclarations {
+
+ BITSTRING fx__enc__CER__MSG(const LibDiameter__TypesAndValues::CER__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__CER__MSG(BITSTRING&, LibDiameter__TypesAndValues::CER__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__CEA__MSG(const LibDiameter__TypesAndValues::CEA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__CEA__MSG(BITSTRING&, LibDiameter__TypesAndValues::CEA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__RAR__MSG(const LibDiameter__TypesAndValues::RAR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__RAR__MSG(BITSTRING&, LibDiameter__TypesAndValues::RAR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__RAA__MSG(const LibDiameter__TypesAndValues::RAA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__RAA__MSG(BITSTRING&, LibDiameter__TypesAndValues::RAA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__ACR__MSG(const LibDiameter__TypesAndValues::ACR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__ACR__MSG(BITSTRING&, LibDiameter__TypesAndValues::ACR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__ACA__MSG(const LibDiameter__TypesAndValues::ACA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__ACA__MSG(BITSTRING&, LibDiameter__TypesAndValues::ACA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__ASR__MSG(const LibDiameter__TypesAndValues::ASR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__ASR__MSG(BITSTRING&, LibDiameter__TypesAndValues::ASR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__ASA__MSG(const LibDiameter__TypesAndValues::ASA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__ASA__MSG(BITSTRING&, LibDiameter__TypesAndValues::ASA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__STR__MSG(const LibDiameter__TypesAndValues::STR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__STR__MSG(BITSTRING&, LibDiameter__TypesAndValues::STR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__STA__MSG(const LibDiameter__TypesAndValues::STA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__STA__MSG(BITSTRING&, LibDiameter__TypesAndValues::STA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__DWR__MSG(const LibDiameter__TypesAndValues::DWR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__DWR__MSG(BITSTRING&, LibDiameter__TypesAndValues::DWR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__DWA__MSG(const LibDiameter__TypesAndValues::DWA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__DWA__MSG(BITSTRING&, LibDiameter__TypesAndValues::DWA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__DPR__MSG(const LibDiameter__TypesAndValues::DPR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__DPR__MSG(BITSTRING&, LibDiameter__TypesAndValues::DPR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__DPA__MSG(const LibDiameter__TypesAndValues::DPA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__DPA__MSG(BITSTRING&, LibDiameter__TypesAndValues::DPA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__UAR__MSG(const LibDiameter__TypesAndValues::UAR__MSG& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__UAR__MSG: ", p);
+
+ float duration;
+ std::string tag("fx__enc__UAR__MSG");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ diameter_uar_codec codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__UAR__MSG: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__UAR__MSG(BITSTRING& pdu, LibDiameter__TypesAndValues::UAR__MSG& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__UAR__MSG: ", p);
+
+ float duration;
+ std::string tag("fx__dec__UAR__MSG");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os = bit2oct(pdu);
+ diameter_uar_codec codec;
+ int result = codec.decode(os, p);
+
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return INTEGER(result);
+ }
+
+ BITSTRING fx__enc__UAA__MSG(const LibDiameter__TypesAndValues::UAA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__UAR__MSG: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__UAR__MSG");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__UAA__MSG(BITSTRING&, LibDiameter__TypesAndValues::UAA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__SAR__MSG(const LibDiameter__TypesAndValues::SAR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__SAR__MSG(BITSTRING&, LibDiameter__TypesAndValues::SAR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__SAA__MSG(const LibDiameter__TypesAndValues::SAA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__SAA__MSG(BITSTRING&, LibDiameter__TypesAndValues::SAA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__LIR__MSG(const LibDiameter__TypesAndValues::LIR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__LIR__MSG(BITSTRING&, LibDiameter__TypesAndValues::LIR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__LIA__MSG(const LibDiameter__TypesAndValues::LIA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__LIA__MSG(BITSTRING&, LibDiameter__TypesAndValues::LIA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__MAR__MSG(const LibDiameter__TypesAndValues::MAR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__MAR__MSG(BITSTRING&, LibDiameter__TypesAndValues::MAR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__MAA__MSG(const LibDiameter__TypesAndValues::MAA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__MAA__MSG(BITSTRING&, LibDiameter__TypesAndValues::MAA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__RTR__MSG(const LibDiameter__TypesAndValues::RTR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__RTR__MSG(BITSTRING&, LibDiameter__TypesAndValues::RTR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__RTA__MSG(const LibDiameter__TypesAndValues::RTA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__RTA__MSG(BITSTRING&, LibDiameter__TypesAndValues::RTA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__PPR__MSG(const LibDiameter__TypesAndValues::PPR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__PPR__MSG(BITSTRING&, LibDiameter__TypesAndValues::PPR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__PPA__MSG(const LibDiameter__TypesAndValues::PPA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__PPA__MSG(BITSTRING&, LibDiameter__TypesAndValues::PPA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__UDR__MSG(const LibDiameter__TypesAndValues::UDR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__UDR__MSG(BITSTRING&, LibDiameter__TypesAndValues::UDR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__UDA__MSG(const LibDiameter__TypesAndValues::UDA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__UDA__MSG(BITSTRING&, LibDiameter__TypesAndValues::UDA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__PUR__MSG(const LibDiameter__TypesAndValues::PUR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__PUR__MSG(BITSTRING&, LibDiameter__TypesAndValues::PUR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__PUA__MSG(const LibDiameter__TypesAndValues::PUA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__PUA__MSG(BITSTRING&, LibDiameter__TypesAndValues::PUA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__SNR__MSG(const LibDiameter__TypesAndValues::SNR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__SNR__MSG(BITSTRING&, LibDiameter__TypesAndValues::SNR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__SNA__MSG(const LibDiameter__TypesAndValues::SNA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__SNA__MSG(BITSTRING&, LibDiameter__TypesAndValues::SNA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__PNR__MSG(const LibDiameter__TypesAndValues::PNR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__PNR__MSG(BITSTRING&, LibDiameter__TypesAndValues::PNR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__PNA__MSG(const LibDiameter__TypesAndValues::PNA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__PNA__MSG(BITSTRING&, LibDiameter__TypesAndValues::PNA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__CCR__MSG(const LibDiameter__TypesAndValues::CCR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__CCR__MSG(BITSTRING&, LibDiameter__TypesAndValues::CCR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__CCA__MSG(const LibDiameter__TypesAndValues::CCA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__CCA__MSG(BITSTRING&, LibDiameter__TypesAndValues::CCA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__AAR__MSG(const LibDiameter__TypesAndValues::AAR__MSG& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__AAR__MSG: ", p);
+
+ float duration;
+ std::string tag("fx__enc__AAR__MSG");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ diameter_aar_codec codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__AAR__MSG: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__AAR__MSG(BITSTRING& pdu, LibDiameter__TypesAndValues::AAR__MSG& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__AAR__MSG: ", pdu);
+
+ float duration;
+ std::string tag("fx__dec__AAR__MSG");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os = bit2oct(pdu);
+ diameter_aar_codec codec;
+ int result = codec.decode(os, p);
+
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return INTEGER(result);
+ }
+
+ BITSTRING fx__enc__AAA__MSG(const LibDiameter__TypesAndValues::AAA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__AAA__MSG(BITSTRING&, LibDiameter__TypesAndValues::AAA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__ULR__MSG(const LibDiameter__TypesAndValues::ULR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__ULR__MSG(BITSTRING&, LibDiameter__TypesAndValues::ULR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__ULA__MSG(const LibDiameter__TypesAndValues::ULA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__ULA__MSG(BITSTRING&, LibDiameter__TypesAndValues::ULA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__AIR__MSG(const LibDiameter__TypesAndValues::AIR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__AIR__MSG(BITSTRING&, LibDiameter__TypesAndValues::AIR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__AIA__MSG(const LibDiameter__TypesAndValues::AIA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__AIA__MSG(BITSTRING&, LibDiameter__TypesAndValues::AIA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__CLR__MSG(const LibDiameter__TypesAndValues::CLR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__CLR__MSG(BITSTRING&, LibDiameter__TypesAndValues::CLR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__CLA__MSG(const LibDiameter__TypesAndValues::CLA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__CLA__MSG(BITSTRING&, LibDiameter__TypesAndValues::CLA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__IDR__MSG(const LibDiameter__TypesAndValues::IDR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__IDR__MSG(BITSTRING&, LibDiameter__TypesAndValues::IDR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__IDA__MSG(const LibDiameter__TypesAndValues::IDA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__IDA__MSG(BITSTRING&, LibDiameter__TypesAndValues::IDA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__DSR__MSG(const LibDiameter__TypesAndValues::DSR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__DSR__MSG(BITSTRING&, LibDiameter__TypesAndValues::DSR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__DSA__MSG(const LibDiameter__TypesAndValues::DSA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__DSA__MSG(BITSTRING&, LibDiameter__TypesAndValues::DSA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__RSR__MSG(const LibDiameter__TypesAndValues::RSR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__RSR__MSG(BITSTRING&, LibDiameter__TypesAndValues::RSR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__RSA__MSG(const LibDiameter__TypesAndValues::RSA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__RSA__MSG(BITSTRING&, LibDiameter__TypesAndValues::RSA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__NOR__MSG(const LibDiameter__TypesAndValues::NOR__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__NOR__MSG(BITSTRING&, LibDiameter__TypesAndValues::NOR__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__NOA__MSG(const LibDiameter__TypesAndValues::NOA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__NOA__MSG(BITSTRING&, LibDiameter__TypesAndValues::NOA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__PUER__MSG(const LibDiameter__TypesAndValues::PUER__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__PUER__MSG(BITSTRING&, LibDiameter__TypesAndValues::PUER__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__PUEA__MSG(const LibDiameter__TypesAndValues::PUEA__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__PUEA__MSG(BITSTRING&, LibDiameter__TypesAndValues::PUEA__MSG& p) { return INTEGER(-1); }
+
+ BITSTRING fx__enc__UNKNOWN__MSG(const LibDiameter__TypesAndValues::UNKNOWN__MSG& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__UNKNOWN__MSG(BITSTRING&, LibDiameter__TypesAndValues::UNKNOWN__MSG& p) { return INTEGER(-1); }
+
+} // End of namespace LibDiameter__EncdecDeclarations
diff --git a/ccsrc/EncDec/LibDiameter/module.mk b/ccsrc/EncDec/LibDiameter/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..5f362ce7c0eb3b80b1afcaf71eec306df910404a
--- /dev/null
+++ b/ccsrc/EncDec/LibDiameter/module.mk
@@ -0,0 +1,2 @@
+sources := \
+ LibDiameter_EncDec.cc
diff --git a/ccsrc/EncDec/LibEmtel/LibNg112_EncDec.cc b/ccsrc/EncDec/LibEmtel/LibNg112_EncDec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b13692a172270bb06e2aa90ffb8ca117ea1aa71d
--- /dev/null
+++ b/ccsrc/EncDec/LibEmtel/LibNg112_EncDec.cc
@@ -0,0 +1,130 @@
+#include "LibNg112_EncdecDeclarations.hh"
+
+#include "json_codec.hh"
+
+#include "loggers.hh"
+
+namespace LibNg112__EncdecDeclarations { // TODO File to be removed
+
+/* BITSTRING enc__DequeueRegistrationRequest(const LibNg112__DequeueRegistration::DequeueRegistrationRequest& p) {
+ loggers::get_instance().log_msg(">>> enc__DequeueRegistrationRequest: ", (const Base_Type&)p);
+
+ OCTETSTRING os;
+ json_codec codec;
+ codec.encode(p, os);
+
+ return oct2bit(os);
+ }
+
+ INTEGER dec__DequeueRegistrationRequest(BITSTRING& pdu, LibNg112__DequeueRegistration::DequeueRegistrationRequest& p) {
+ loggers::get_instance().log_msg(">>> dec__DequeueRegistrationRequest: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ json_codec codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ BITSTRING enc__DequeueRegistrationResponse(const LibNg112__DequeueRegistration::DequeueRegistrationResponse& p) {
+ loggers::get_instance().log_msg(">>> enc__DequeueRegistrationResponse: ", (const Base_Type&)p);
+
+ OCTETSTRING os;
+ json_codec codec;
+ codec.encode(p, os);
+
+ return oct2bit(os);
+ }
+
+ INTEGER dec__DequeueRegistrationResponse(BITSTRING& pdu, LibNg112__DequeueRegistration::DequeueRegistrationResponse& p) {
+ loggers::get_instance().log_msg(">>> dec__DequeueRegistrationResponse: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ json_codec codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ BITSTRING enc__ServiceStatePayload(const LibNg112__SubscriptionPayloads::ServiceStatePayload& p) {
+ loggers::get_instance().log_msg(">>> enc__ServiceStatePayload: ", (const Base_Type&)p);
+
+ OCTETSTRING os;
+ json_codec codec;
+ codec.encode(p, os);
+
+ return oct2bit(os);
+ }
+
+ INTEGER dec__ServiceStatePayload(BITSTRING& pdu, LibNg112__SubscriptionPayloads::ServiceStatePayload& p) {
+ loggers::get_instance().log_msg(">>> dec__ServiceStatePayload: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ json_codec codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ BITSTRING enc__ElementStatePayload(const LibNg112__SubscriptionPayloads::ElementStatePayload& p) {
+ loggers::get_instance().log_msg(">>> enc__ElementStatePayload: ", (const Base_Type&)p);
+
+ OCTETSTRING os;
+ json_codec codec;
+ codec.encode(p, os);
+
+ return oct2bit(os);
+ }
+
+ INTEGER dec__ElementStatePayload(BITSTRING& pdu, LibNg112__SubscriptionPayloads::ElementStatePayload& p) {
+ loggers::get_instance().log_msg(">>> dec__ElementStatePayload: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ json_codec codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ BITSTRING enc__SecurityPosturePayload(const LibNg112__SubscriptionPayloads::SecurityPosturePayload& p) {
+ loggers::get_instance().log_msg(">>> enc__SecurityPosturePayload: ", (const Base_Type&)p);
+
+ OCTETSTRING os;
+ json_codec codec;
+ codec.encode(p, os);
+
+ return oct2bit(os);
+ }
+
+ INTEGER dec__SecurityPosturePayload(BITSTRING& pdu, LibNg112__SubscriptionPayloads::SecurityPosturePayload& p) {
+ loggers::get_instance().log_msg(">>> dec__QueueStdec__SecurityPosturePayloadtePayload: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ json_codec codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ BITSTRING enc__QueueStatePayload(const LibNg112__SubscriptionPayloads::QueueStatePayload& p) {
+ loggers::get_instance().log_msg(">>> enc__QueueStatePayload: ", (const Base_Type&)p);
+
+ OCTETSTRING os;
+ json_codec codec;
+ codec.encode(p, os);
+
+ return oct2bit(os);
+ }
+
+ INTEGER dec__QueueStatePayload(BITSTRING& pdu, LibNg112__SubscriptionPayloads::QueueStatePayload& p) {
+ loggers::get_instance().log_msg(">>> dec__QueueStatePayload: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ json_codec codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+*/
+} // End of namespace LibNg112__EncdecDeclarations
+
diff --git a/ccsrc/EncDec/LibEmtel/module.mk b/ccsrc/EncDec/LibEmtel/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..43f2b71da14e30dd5787c7c62c3ec752d93fe363
--- /dev/null
+++ b/ccsrc/EncDec/LibEmtel/module.mk
@@ -0,0 +1 @@
+sources := LibNg112_EncDec.cc
diff --git a/ccsrc/EncDec/LibMsrp/LibMsrp_EncDec.cc b/ccsrc/EncDec/LibMsrp/LibMsrp_EncDec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9786ab576e1a90b523246a89ee416c1320b5983f
--- /dev/null
+++ b/ccsrc/EncDec/LibMsrp/LibMsrp_EncDec.cc
@@ -0,0 +1,24 @@
+
+#include "LibMsrp_EncDecDeclarations.hh"
+
+#include "loggers.hh"
+
+namespace LibMsrp__EncDecDeclarations {
+
+ BITSTRING fx__enc__MsrpURI(const LibMsrp__TypesAndValues::MsrpURI& p) {
+ loggers::get_instance().log_msg(">>> BITSTRING fx__enc__MsrpURI: ", p);
+
+ float duration;
+ std::string tag(" BITSTRING fx__enc__MsrpURI");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ // TODO
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__MsrpURI(BITSTRING&, LibMsrp__TypesAndValues::MsrpURI& p) { return INTEGER(0); }
+
+} // End of module LibMsrp__EncDecDeclarations
\ No newline at end of file
diff --git a/ccsrc/EncDec/LibMsrp/module.mk b/ccsrc/EncDec/LibMsrp/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..52b99146a8c68753ac06d93428acde77e2373942
--- /dev/null
+++ b/ccsrc/EncDec/LibMsrp/module.mk
@@ -0,0 +1,2 @@
+sources := \
+ LibMsrp_EncDec.cc
diff --git a/ccsrc/EncDec/LibNgNas/NAS_EncDec.cc b/ccsrc/EncDec/LibNgNas/NAS_EncDec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4966fb58ac5a57bdfaf543c9692115474f0905fc
--- /dev/null
+++ b/ccsrc/EncDec/LibNgNas/NAS_EncDec.cc
@@ -0,0 +1,45 @@
+/*!
+ * \file NAS_EncDec.cc
+ * \brief CC file for NAS encode/decode functions.
+ * \author ETSI TTF041
+ * \copyright ETSI Copyright Notification
+ * No part may be reproduced except as authorized by written permission.
+ * The copyright and the foregoing restriction extend to reproduction in all media.
+ * All rights reserved.
+ * \version 0.1
+ */
+
+#include "NAS_EncdecDeclarations.hh"
+#include "NAS_CommonTypeDefs.hh"
+//#include "SMS_TypeDefs.hh"
+
+namespace NAS__EncdecDeclarations {
+
+ /****************************************************
+ * @desc External function to encode a ... type
+ * @param value to encode
+ * @return encoded value
+ ****************************************************/
+
+ BITSTRING fx__enc__PacketFilterComponent(const NAS__CommonTypeDefs::PacketFilterComponent &p){return int2bit(0,0);}
+ BITSTRING fx__enc__QoSParametersList(const NAS__CommonTypeDefs::QoSParametersList &p){return int2bit(0,0);}
+ BITSTRING fx__enc__EPS__QualityOfService(const NAS__CommonTypeDefs::EPS__QualityOfService &p){return int2bit(0,0);}
+ BITSTRING fx__enc__TrafficFlowTemplate(const NAS__CommonTypeDefs::TrafficFlowTemplate &p){return int2bit(0,0);}
+ // BITSTRING fx__enc__CP__PDU__Type(const SMS__TypeDefs::CP__PDU__Type &p){return int2bit(0,0);}
+
+ /****************************************************
+ * @desc External function to decode a ... type
+ * @param value to encode
+ * @return encoded value
+ ****************************************************/
+ INTEGER fx__dec__PacketFilterComponent (BITSTRING &b, NAS__CommonTypeDefs::PacketFilterComponent &p) {return -1;}
+ INTEGER fx__dec__QoSParametersList (BITSTRING &b, NAS__CommonTypeDefs::QoSParametersList &p) {return -1;}
+ INTEGER fx__dec__EPS__QualityOfService (BITSTRING &b, NAS__CommonTypeDefs::EPS__QualityOfService &p) {return -1;}
+ INTEGER fx__dec__TrafficFlowTemplate (BITSTRING &b, NAS__CommonTypeDefs::TrafficFlowTemplate &p) {return -1;}
+ // INTEGER fx__dec__CP__PDU__Type (BITSTRING &b, SMS__TypeDefs::CP__PDU__Type &p) {return -1;}
+
+
+} // namespace NAS__EncdecDeclarations
+
+
+
diff --git a/ccsrc/EncDec/LibNgNas/NG_NAS_EncDec.cc b/ccsrc/EncDec/LibNgNas/NG_NAS_EncDec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..af95a84a981441b29cdd7991d2aac5e395319b5a
--- /dev/null
+++ b/ccsrc/EncDec/LibNgNas/NG_NAS_EncDec.cc
@@ -0,0 +1,45 @@
+/*!
+ * \file NG_NAS_EncDec.cc
+ * \brief CC file for NG_NAS encode/decode functions.
+ * \author ETSI TTF041
+ * \copyright ETSI Copyright Notification
+ * No part may be reproduced except as authorized by written permission.
+ * The copyright and the foregoing restriction extend to reproduction in all media.
+ * All rights reserved.
+ * \version 0.1
+ */
+
+#include "NG_NAS_EncdecDeclarations.hh"
+#include "NG_NAS_MsgContainers.hh"
+#include "NG_NAS_TypeDefs.hh"
+#include "EAP_TypeDefs.hh"
+
+namespace NG__NAS__EncdecDeclarations {
+
+ /****************************************************
+ * @desc External function to encode a ... type
+ * @param value to encode
+ * @return encoded value
+ ****************************************************/
+
+ BITSTRING fx__enc__NG__NAS__UL__Message__Type(const NG__NAS__MsgContainers::NG__NAS__UL__Message__Type &p){return int2bit(0,0);}
+ BITSTRING fx__enc__NG__NAS__DL__Message__Type(const NG__NAS__MsgContainers::NG__NAS__DL__Message__Type &p){return int2bit(0,0);}
+ BITSTRING fx__enc__IntraN1TransparentContainer(const NG__NAS__TypeDefs::IntraN1TransparentContainer &p){return int2bit(0,0);}
+ BITSTRING fx__enc__CIoTSmallDataContainer(const NG__NAS__TypeDefs::CIoTSmallDataContainer &p){return int2bit(0,0);}
+ BITSTRING fx__enc__EAP__Message__Type(const EAP__TypeDefs::EAP__Message__Type &p){return int2bit(0,0);}
+
+ /****************************************************
+ * @desc External function to decode a ... type
+ * @param value to encode
+ * @return encoded value
+ ****************************************************/
+ INTEGER fx__dec__NG__NAS__UL__Message__Type(BITSTRING &b, NG__NAS__MsgContainers::NG__NAS__UL__Message__Type &p) {return -1;}
+ INTEGER fx__dec__NG__NAS__DL__Message__Type(BITSTRING &b, NG__NAS__MsgContainers::NG__NAS__DL__Message__Type &p) {return -1;}
+ INTEGER fx__dec__IntraN1TransparentContainer(BITSTRING &b, NG__NAS__TypeDefs::IntraN1TransparentContainer &p) {return -1;}
+ INTEGER fx__dec__CIoTSmallDataContainer(BITSTRING &b, NG__NAS__TypeDefs::CIoTSmallDataContainer &p) {return -1;}
+ INTEGER fx__dec__EAP__Message__Type(BITSTRING &b, EAP__TypeDefs::EAP__Message__Type &p) {return -1;}
+
+
+} // namespace NG__NAS__EncdecDeclarations
+
+
diff --git a/ccsrc/EncDec/LibNgNas/module.mk b/ccsrc/EncDec/LibNgNas/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..39599f1b81e20c454b627c63b63275736c341025
--- /dev/null
+++ b/ccsrc/EncDec/LibNgNas/module.mk
@@ -0,0 +1,14 @@
+sources := \
+ NAS_EncDec.cc \
+ NG_NAS_EncDec.cc
+
+
+ #Dhcpv4_Encdec.cc \
+ #Dns_Encdec.cc \
+ #ICMPv6_Encdec.cc \
+ #HTTP_ASP_Encdec.cc \
+ #NR_Encdec.cc \
+ #LPP_PDU_EncDec.cc \
+ #NAS_EncDec.cc \
+ #NG_NAS_EncDec.cc
+ #NR_PDCP_Encdec.cc
diff --git a/ccsrc/EncDec/LibSip/LibSip_Encdec.cc b/ccsrc/EncDec/LibSip/LibSip_Encdec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..add0174651c9c2875983a50eaef8a6fc7a730cbe
--- /dev/null
+++ b/ccsrc/EncDec/LibSip/LibSip_Encdec.cc
@@ -0,0 +1,372 @@
+
+#include "LibSip_EncdecDeclarations.hh"
+#include "LibSip_XMLTypes.hh"
+
+#include "sip_codec_register_request.hh"
+#include "sip_codec_invite_request.hh"
+#include "sip_codec_options_request.hh"
+#include "sip_codec_bye_request.hh"
+#include "sip_codec_ack_request.hh"
+#include "sip_codec_subscribe_request.hh"
+#include "sip_codec_notify_request.hh"
+#include "sip_codec_info_request.hh"
+#include "sip_codec_message_request.hh"
+#include "sip_codec_message_body.hh"
+#include "sip_codec_response.hh"
+
+#include "loggers.hh"
+
+namespace LibSip__EncdecDeclarations {
+
+ BITSTRING fx__enc__Request(const LibSip__SIPTypesAndValues::Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__Request -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__REGISTER__Request(const LibSip__SIPTypesAndValues::REGISTER__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__REGISTER__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__REGISTER__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_register_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__REGISTER__Request: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__INVITE__Request(const LibSip__SIPTypesAndValues::INVITE__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__INVITE__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__INVITE__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_invite_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__INVITE__Request: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__OPTIONS__Request(const LibSip__SIPTypesAndValues::OPTIONS__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__OPTIONS__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__OPTIONS__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_options_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__OPTIONS__Request: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__BYE__Request(const LibSip__SIPTypesAndValues::BYE__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__BYE__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__BYE__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_bye_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__BYE__Request: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__ACK__Request(const LibSip__SIPTypesAndValues::ACK__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__ACK__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__ACK__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_ack_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__ACK__Request: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__CANCEL__Request(const LibSip__SIPTypesAndValues::CANCEL__Request& p) { return BITSTRING(); }
+ BITSTRING fx__enc__PRACK__Request(const LibSip__SIPTypesAndValues::PRACK__Request& p) { return BITSTRING(); }
+ BITSTRING fx__enc__NOTIFY__Request(const LibSip__SIPTypesAndValues::NOTIFY__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__NOTIFY__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__NOTIFY__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_notify_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__NOTIFY__Request: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__SUBSCRIBE__Request(const LibSip__SIPTypesAndValues::SUBSCRIBE__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__SUBSCRIBE__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__SUBSCRIBE__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_subscribe_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__SUBSCRIBE__Request: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__MESSAGE__Request(const LibSip__SIPTypesAndValues::MESSAGE__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__MESSAGE__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__MESSAGE__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_message_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__MESSAGE__Request: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__PUBLISH__Request(const LibSip__SIPTypesAndValues::PUBLISH__Request& p) { return BITSTRING(); }
+ BITSTRING fx__enc__UPDATE__Request(const LibSip__SIPTypesAndValues::UPDATE__Request& p) { return BITSTRING(); }
+ BITSTRING fx__enc__REFER__Request(const LibSip__SIPTypesAndValues::REFER__Request& p) { return BITSTRING(); }
+ BITSTRING fx__enc__INFO__Request(const LibSip__SIPTypesAndValues::INFO__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__INFO__Request: ", p);
+
+ float duration;
+ std::string tag("fx__enc__INFO__Request");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_info_request codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__INFO__Request: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+
+ BITSTRING fx__enc__Response(const LibSip__SIPTypesAndValues::Response& p) {
+ loggers::get_instance().log_msg(">>> fx__enc__Response: ", p);
+
+ float duration;
+ std::string tag("fx__enc__Response");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_response codec;
+ if (codec.encode(p, os) == -1) {
+ loggers::get_instance().warning("fx__enc__Response: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ BITSTRING fx__enc__Raw(const CHARSTRING& p) { return BITSTRING(); }
+ BITSTRING fx__enc__SMS(const LibSip__SimpleMsgSummaryTypes::SimpleMsgSummary& pdu) { return BITSTRING(); }
+
+ BITSTRING fx__enc__MessageBody(const LibSip__MessageBodyTypes::MessageBody& pdu) {
+ loggers::get_instance().log_msg(">>> fx__enc__MessageBody: ", pdu);
+
+ float duration;
+ std::string tag("fx__enc__MessageBody");
+ loggers::get_instance().set_start_time(tag);
+
+ OCTETSTRING os;
+ sip_codec_message_body codec;
+ if (codec.encode(pdu, os) == -1) {
+ loggers::get_instance().warning("fx__enc__MessageBody: -1 result code was returned");
+ return int2bit(0, 1);
+ }
+ loggers::get_instance().set_stop_time(tag, duration);
+
+ return oct2bit(os);
+ }
+
+ INTEGER fx__dec__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__REGISTER__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::REGISTER__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__REGISTER__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_register_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__INVITE__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::INVITE__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__INVITE__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_invite_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__OPTIONS__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::OPTIONS__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__OPTIONS__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_options_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__BYE__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::BYE__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__BYE__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_bye_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__ACK__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::ACK__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__ACK__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_ack_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__CANCEL__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::CANCEL__Request& p) { return INTEGER(0); }
+ INTEGER fx__dec__PRACK__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::PRACK__Request& p) { return INTEGER(0); }
+ INTEGER fx__dec__NOTIFY__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::NOTIFY__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__NOTIFY__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_notify_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__SUBSCRIBE__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::SUBSCRIBE__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__SUBSCRIBE__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_subscribe_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__MESSAGE__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::MESSAGE__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__MESSAGE__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_message_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__PUBLISH__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::PUBLISH__Request& p) { return INTEGER(0); }
+ INTEGER fx__dec__UPDATE__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::UPDATE__Request& p) { return INTEGER(0); }
+ INTEGER fx__dec__REFER__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::REFER__Request& p) { return INTEGER(0); }
+ INTEGER fx__dec__INFO__Request(BITSTRING& pdu, LibSip__SIPTypesAndValues::INFO__Request& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__INFO__Request: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_info_request codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__Response(BITSTRING& pdu, LibSip__SIPTypesAndValues::Response& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__Response: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_response codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+
+ INTEGER fx__dec__SMS(BITSTRING& pdu, LibSip__SimpleMsgSummaryTypes::SimpleMsgSummary& p) { return INTEGER(0); }
+
+ INTEGER fx__dec__MessageBody(BITSTRING& pdu, LibSip__MessageBodyTypes::MessageBody& p) {
+ loggers::get_instance().log_msg(">>> fx__dec__MessageBody: ", pdu);
+
+ OCTETSTRING os = bit2oct(pdu);
+ sip_codec_message_body codec;
+ codec.decode(os, p);
+
+ return 0;
+ }
+} // End of namespace LibSip__EncdecDeclarations
diff --git a/ccsrc/EncDec/LibSip/LibSip_SMSFunctions_Encdec.cc b/ccsrc/EncDec/LibSip/LibSip_SMSFunctions_Encdec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..65e0af8cc95a391b028b21fe17c22ce0087fe2d6
--- /dev/null
+++ b/ccsrc/EncDec/LibSip/LibSip_SMSFunctions_Encdec.cc
@@ -0,0 +1,9 @@
+#include "LibSip_SMSFunctions.hh"
+
+#include "loggers.hh"
+
+namespace LibSip__SMSFunctions {
+
+ HEXSTRING fx__GetSC__TimeStamp(const INTEGER& p__TimeZone) { return int2hex(0, 14); };
+
+} // End of namespace LibSip__SMSFunctions
diff --git a/ccsrc/EncDec/LibSip/LibSip_Steps_Encdec.cc b/ccsrc/EncDec/LibSip/LibSip_Steps_Encdec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..35a297030547f04b8b6018af78340957a0351077
--- /dev/null
+++ b/ccsrc/EncDec/LibSip/LibSip_Steps_Encdec.cc
@@ -0,0 +1,109 @@
+#include
+#include
+#include
+
+#include
+
+#include "LibSip_Steps.hh"
+
+#include "loggers.hh"
+
+#include "converter.hh"
+
+namespace LibSip__Steps {
+
+ int calculate_md5(const std::string& p_data, std::string& p_md5)
+ {
+ loggers::get_instance().log(">>> calculate_md5: %s", p_data.c_str());
+
+ MD5_CTX md5_context;
+ ::MD5_Init(&md5_context);
+
+ loggers::get_instance().log("calculate_md5: length=%d", p_data.length());
+ ::MD5_Update(&md5_context, p_data.c_str(), p_data.length()); // TODO Add support of block size > 512
+
+ const size_t digestlen = 16;
+ unsigned char digest[digestlen];
+ ::MD5_Final(digest, &md5_context);
+ p_md5 = converter::get_instance().bytes_to_hexa(std::vector(digest, digest + digestlen));
+
+ loggers::get_instance().log("<<< calculate_md5: %s", p_md5.c_str());
+ return 0;
+ }
+
+ CHARSTRING fx__rndStr() {
+ static const char alphanum[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ static int length = 10;
+ char s[length] = { 0 };
+ for (int i = 0; i < length - 1; ++i) {
+ s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
+ } // End of 'for' statement
+ return CHARSTRING(s);
+ };
+
+ CHARSTRING fx__putInLowercase(const CHARSTRING& p__string) {
+ std::string s(static_cast(p__string));
+ std::transform(s.begin(), s.end(), s.begin(), ::tolower);
+ return CHARSTRING(s.c_str());
+ };
+
+ CHARSTRING fx__getIpAddr(const CHARSTRING& p__host__name) { return CHARSTRING(""); };
+
+ CHARSTRING fx__calculateDigestResponse(const CHARSTRING& p__nonce, const CHARSTRING& p__cnonce, const CHARSTRING& p__user, const CHARSTRING& p__realm, const CHARSTRING& p__passwd, const CHARSTRING& p__alg, const CHARSTRING& p__nonceCount, const CHARSTRING& p__method, const CHARSTRING& p__qop, const CHARSTRING& p__URI, const CHARSTRING& p__HEntity) {
+ loggers::get_instance().log(">>> fx__calculateDigestResponse");
+
+ // Buid a1=USERNAME:REALM:PASSWORD
+ std::string a1(static_cast(p__user));
+ a1 += ":";
+ a1 += static_cast(p__realm);
+ a1 += ":";
+ a1 += static_cast(p__passwd);
+ if (a1.find("\"") != std::string::npos) {
+ a1 = std::regex_replace(a1, std::regex("\""), "");
+ }
+ loggers::get_instance().log("fx__calculateDigestResponse: a1='%s'", a1.c_str());
+ std::string md5_a1;
+ calculate_md5(a1, md5_a1);
+
+ // Buid a2=METHOD:DIGESTURI
+ std::string a2(static_cast(p__method));
+ a2 += ":";
+ a2 += static_cast(p__URI);
+ if (a2.find("\"") != std::string::npos) {
+ a2 = std::regex_replace(a2, std::regex("\""), ""); // TODO Move to converter
+ }
+ loggers::get_instance().log("fx__calculateDigestResponse: a2='%s'", a2.c_str());
+ std::string md5_a2;
+ calculate_md5(a2, md5_a2);
+
+ // Buid resp=HA1:NONCE:HA2
+ std::string resp(md5_a1);
+ resp += ":";
+ resp += static_cast(p__nonce);
+ resp += ":";
+ resp += md5_a2;
+ loggers::get_instance().log("fx__calculateDigestResponse: resp='%s'", resp.c_str());
+ std::string md5_resp;
+ calculate_md5(resp, md5_resp);
+
+ // Convert into Base64
+ std::vector u = converter::get_instance().string_to_bytes(md5_resp);
+ md5_resp = converter::get_instance().bytes_to_string(converter::get_instance().buffer_to_base64(u));
+
+ loggers::get_instance().log("<<< fx__calculateDigestResponse: '%s'", md5_resp.c_str());
+ return CHARSTRING(md5_resp.c_str());
+ };
+
+ CHARSTRING fx__encodeBase64(const CHARSTRING& p__value) {
+ std::vector s(static_cast(p__value), static_cast(p__value) + p__value.lengthof());
+ std::vector o = converter::get_instance().buffer_to_base64(s);
+ return CHARSTRING(o.size(), (const char*)o.data());
+ };
+
+ CHARSTRING fx__decodeBase64(const CHARSTRING& p__value) {
+ std::vector s(static_cast(p__value), static_cast(p__value) + p__value.lengthof());
+ std::vector o = converter::get_instance().base64_to_buffer(s);
+ return CHARSTRING(o.size(), (const char*)o.data());
+ };
+
+} // End of namespace LibSip__Steps
diff --git a/ccsrc/EncDec/LibSip/LibSip_Templates_Encdec.cc b/ccsrc/EncDec/LibSip/LibSip_Templates_Encdec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2c68f22cdfaecf05680cf3ebfc960365d5daa729
--- /dev/null
+++ b/ccsrc/EncDec/LibSip/LibSip_Templates_Encdec.cc
@@ -0,0 +1,9 @@
+#include "LibSip_Templates.hh"
+
+#include "loggers.hh"
+
+namespace LibSip__Templates {
+
+ INTEGER fx__calculateXMLBodyLen(const LibSip__XMLTypes::XmlBody& p__mb) { return INTEGER(0); };
+
+} // End of namespace LibSip__Templates
diff --git a/ccsrc/EncDec/LibSip/module.mk b/ccsrc/EncDec/LibSip/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..86e171030bc6242e576f593006e3c11ab9792dc2
--- /dev/null
+++ b/ccsrc/EncDec/LibSip/module.mk
@@ -0,0 +1,5 @@
+sources := \
+ LibSip_Encdec.cc \
+ LibSip_SMSFunctions_Encdec.cc \
+ LibSip_Steps_Encdec.cc \
+ LibSip_Templates_Encdec.cc
diff --git a/ccsrc/Externals/LIB_NG_NAS_CommonFunctions_ext.cc b/ccsrc/Externals/LIB_NG_NAS_CommonFunctions_ext.cc
new file mode 100644
index 0000000000000000000000000000000000000000..af31102dbdf751762e8c4715e5e2e8c0cfb0f6d0
--- /dev/null
+++ b/ccsrc/Externals/LIB_NG_NAS_CommonFunctions_ext.cc
@@ -0,0 +1,322 @@
+//#include "LIB_NG_NAS_Functions.hh"
+
+#include "loggers.hh"
+
+#include "rijndael.hh"
+#include "opc.hh"
+
+namespace Lib__NG__NAS__CommonFunctions {
+
+ static uint8_t OP[16] = {0}; // FIXME FSCOM To be refined. This is a Q&D implementation
+
+ void fx__set__op(const OCTETSTRING& p_op) {
+ loggers::get_instance().log_msg(">>> fx__set__op: p_op: ", p_op);
+ std::memcpy(OP, static_cast(p_op), 16);
+ loggers::get_instance().log_to_hexa("<<< fx__set__op: OP: ", static_cast(OP), 16);
+ }
+
+ void fx__get__op(OCTETSTRING& p_op) {
+ loggers::get_instance().log_msg(">>> fx__get__op: p_op: ", p_op);
+ p_op = OCTETSTRING(16, static_cast(OP));
+ loggers::get_instance().log_msg("<<< fx__get__op: OP: ", p_op);
+ }
+
+ INTEGER fx__compute__opc(const OCTETSTRING& p_authK, OCTETSTRING& p_opc) {
+ loggers::get_instance().log_msg(">>> fx_compute_opc: OP: ", OCTETSTRING(16, static_cast(OP)));
+
+ rijndael r;
+ r.rijndael_key_schedule(p_authK);
+ opc op(r, OP);
+ uint8_t op_c[16] = { 0x00 };
+ op.compute_opc(op_c);
+ p_opc = OCTETSTRING(16, static_cast(op_c));
+
+ loggers::get_instance().log_msg("<<< fx_compute_opc: OPC: ", p_opc);
+ return 0;
+ }
+
+ INTEGER fx__rijndael__encrypt(const OCTETSTRING& p_key, const OCTETSTRING& p_plain_text, OCTETSTRING& p_cypherer_text) {
+ loggers::get_instance().log_msg(">>> fx__rijndael__encrypt: p_key: ", p_key);
+ loggers::get_instance().log_msg(">>> fx__rijndael__encrypt: p_plain_text: ", p_plain_text);
+
+ rijndael r;
+ r.rijndael_key_schedule(p_key);
+ uint8_t cypherer_text[16] = { 0x00 };
+ r.rijndael_encrypt(static_cast(p_plain_text), cypherer_text);
+ p_cypherer_text = OCTETSTRING(16, static_cast(cypherer_text));
+
+ loggers::get_instance().log_msg("<<< fx__rijndael__encrypt: p_cypherer_text: ", p_cypherer_text);
+ return 0;
+ }
+
+ INTEGER fx__f1(const BITSTRING& p_authK, const BITSTRING& p_rand, const BITSTRING& p_sqn, const BITSTRING& p_amf, BITSTRING& p_mac_a) {
+ loggers::get_instance().log_msg(">>> fx__f1: p_authK: ", bit2oct(p_authK));
+ loggers::get_instance().log_msg(">>> fx__f1: p_rand: ", bit2oct(p_rand));
+
+ rijndael r;
+ OCTETSTRING authK = bit2oct(p_authK);
+ r.rijndael_key_schedule(authK);
+ opc op(r, OP);
+ uint8_t op_c[16] = { 0x00 };
+ op.compute_opc(op_c);
+ loggers::get_instance().log_to_hexa("fx__f1: op_c: ", op_c, 16);
+
+ OCTETSTRING rand = bit2oct(p_rand);
+ uint8_t rijndael_input[16] = { 0x00 };
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[i] = rand[i].get_octet() ^ op_c[i];
+ } // End of 'for' statement
+ uint8_t temp[16] = { 0x00 };
+ r.rijndael_encrypt(rijndael_input, temp);
+ loggers::get_instance().log_to_hexa("fx__f1: Value after 1st encryption: ", temp, 16);
+
+ OCTETSTRING sqn = bit2oct(p_sqn);
+ uint8_t in1[16] = { 0x00 };
+ for (int i = 0; i < 6; i++) {
+ in1[i] = sqn[i].get_octet();
+ in1[i + 8] = sqn[i].get_octet();
+ } // End of 'for' statement
+ OCTETSTRING amf = bit2oct(p_amf);
+ for (int i = 0; i < 2; i++) {
+ in1[i + 6] = amf[i].get_octet();
+ in1[i + 14] = amf[i].get_octet();
+ } // End of 'for' statement
+
+ // XOR op_c and in1, rotate by r1=64, and XOR on the constant c1 (which is all zeroes)
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[(i + 8) % 16] = in1[i] ^ op_c[i];
+ }
+
+ // XOR on the value temp computed before
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[i] ^= temp[i];
+ } // End of 'for' statement
+
+ uint8_t out1[16] = { 0x00 };
+ r.rijndael_encrypt(rijndael_input, out1);
+ loggers::get_instance().log_to_hexa("fx__f1: Value after 2sd encryption: ", out1, 16);
+
+ for (int i = 0; i < 16; i++) {
+ out1[i] ^= op_c[i];
+ } // End of 'for' statement
+
+ uint8_t mac_a[8] = { 0x00 };
+ for (int i = 0; i < 8; i++) {
+ mac_a[i] = out1[i];
+ } // End of 'for' statement
+ OCTETSTRING os(8, static_cast(&mac_a[0]));
+ p_mac_a = oct2bit(os);
+ loggers::get_instance().log_msg("fx__f1star: p_mac_a: ", os);
+
+ return 0;
+ }
+
+ INTEGER fx__f1star(const BITSTRING& p_authK, const BITSTRING& p_rand, const BITSTRING& p_sqn, const BITSTRING& p_amf, BITSTRING& p_mac_s) {
+ loggers::get_instance().log_msg(">>> fx__f1star: p_authK: ", bit2oct(p_authK));
+ loggers::get_instance().log_msg(">>> fx__f1star: p_rand: ", bit2oct(p_rand));
+
+ rijndael r;
+ OCTETSTRING authK = bit2oct(p_authK);
+ r.rijndael_key_schedule(authK);
+ opc op(r, OP);
+ uint8_t op_c[16] = { 0x00 };
+ op.compute_opc(op_c);
+ loggers::get_instance().log_to_hexa("fx__f1star: op_c: ", op_c, 16);
+
+ OCTETSTRING rand = bit2oct(p_rand);
+ uint8_t rijndael_input[16] = { 0x00 };
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[i] = rand[i].get_octet() ^ op_c[i];
+ } // End of 'for' statement
+ uint8_t temp[16] = { 0x00 };
+ r.rijndael_encrypt(rijndael_input, temp);
+ loggers::get_instance().log_to_hexa("fx__f1star: Value after 1st encryption: ", temp, 16);
+
+ OCTETSTRING sqn = bit2oct(p_sqn);
+ uint8_t in1[16] = { 0x00 };
+ for (int i = 0; i < 6; i++) {
+ in1[i] = sqn[i].get_octet();
+ in1[i + 8] = sqn[i].get_octet();
+ } // End of 'for' statement
+ OCTETSTRING amf = bit2oct(p_amf);
+ for (int i = 0; i < 2; i++) {
+ in1[i + 6] = amf[i].get_octet();
+ in1[i + 14] = amf[i].get_octet();
+ } // End of 'for' statement
+
+ // XOR op_c and in1, rotate by r1=64, and XOR on the constant c1 (which is all zeroes)
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[(i + 8) % 16] = in1[i] ^ op_c[i];
+ }
+
+ // XOR on the value temp computed before
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[i] ^= temp[i];
+ } // End of 'for' statement
+
+ uint8_t out1[16] = { 0x00 };
+ r.rijndael_encrypt(rijndael_input, out1);
+ loggers::get_instance().log_to_hexa("fx__f1: Value after 2sd encryption: ", out1, 16);
+
+ for (int i = 0; i < 16; i++) {
+ out1[i] ^= op_c[i];
+ } // End of 'for' statement
+
+ uint8_t mac_s[8] = { 0x00 };
+ for (int i = 0; i < 8; i++) {
+ mac_s[i] = out1[i + 8];
+ } // End of 'for' statement
+ OCTETSTRING os(8, static_cast(&mac_s[0]));
+ p_mac_s = oct2bit(os);
+ loggers::get_instance().log_msg("fx__f1star: p_mac_s: ", os);
+
+ return 0;
+ }
+
+ INTEGER fx__f2345(const BITSTRING& p_authK, const BITSTRING& p_rand, BITSTRING& p_res, BITSTRING& p_ck, BITSTRING& p_ik, BITSTRING& p_ak) {
+ loggers::get_instance().log_msg(">>> fx__f2345: p_authK: ", bit2oct(p_authK));
+ loggers::get_instance().log_msg(">>> fx__f2345: p_rand: ", bit2oct(p_rand));
+
+ rijndael r;
+ OCTETSTRING authK = bit2oct(p_authK);
+ r.rijndael_key_schedule(authK);
+ opc op(r, OP);
+ uint8_t op_c[16] = { 0x00 };
+ op.compute_opc(op_c);
+ loggers::get_instance().log_to_hexa("fx__f2345: a entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", op_c, 16);
+
+ OCTETSTRING rand = bit2oct(p_rand);
+ uint8_t rijndael_input[16] = { 0x00 };
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[i] = rand[i].get_octet() ^ op_c[i];
+ } // End of 'for' statement
+ uint8_t temp[16] = { 0x00 };
+ r.rijndael_encrypt(rijndael_input, temp);
+ loggers::get_instance().log_to_hexa("fx__f2345: Value after 1st encryption: ", temp, 16);
+
+ // To obtain output block OUT2: XOR OPc and TEMP, rotate by r2=0, and XOR on the constant c2 (which is all zeroes except that the last bit is 1)
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[i] = temp[i] ^ op_c[i];
+ } // End of 'for' statement
+ rijndael_input[15] ^= 1;
+ loggers::get_instance().log_to_hexa("fx__f2345: b entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", rijndael_input, 16);
+
+ uint8_t out[16] = { 0x00 };
+ r.rijndael_encrypt(rijndael_input, out);
+ loggers::get_instance().log_to_hexa("fx__f2345: f2/d entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", out, 16);
+
+ for (int i = 0; i < 16; i++) {
+ out[i] ^= op_c[i];
+ } // End of 'for' statement
+
+ uint8_t res[8] = { 0x00 };
+ for (int i = 0; i < 8; i++) {
+ res[i] = out[i + 8];
+ } // End of 'for' statement
+ loggers::get_instance().log_to_hexa("fx__f2345: f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", res, 8);
+
+ uint8_t ak[6] = { 0x00 };
+ for (int i = 0; i < 6; i++) {
+ ak[i] = out[i];
+ } // End of 'for' statement
+ loggers::get_instance().log_to_hexa("fx__f2345: f5/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", ak, 6);
+
+ // To obtain output block OUT3: XOR OPc and TEMP, rotate by r3=32, and XOR on the constant c3 (which is all zeroes except that the next to last bit is 1)
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[(i + 12) % 16] = temp[i] ^ op_c[i];
+ } // End of 'for' statement
+ rijndael_input[15] ^= 2;
+ loggers::get_instance().log_to_hexa("fx__f2345: f3/c entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", out, 16);
+ r.rijndael_encrypt(rijndael_input, out);
+ loggers::get_instance().log_to_hexa("fx__f2345: f3/d entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", out, 16);
+
+ for (int i = 0; i < 16; i++) {
+ out[i] ^= op_c[i];
+ } // End of 'for' statement
+
+ uint8_t ck[16] = { 0x00 };
+ for (int i = 0; i < 16; i++) {
+ ck[i] = out[i];
+ } // End of 'for' statement
+ loggers::get_instance().log_to_hexa("fx__f2345: f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", ck, 16);
+
+ // To obtain output block OUT4: XOR OPc and TEMP, rotate by r4=64, and XOR on the constant c4 (which is all zeroes except that the 2nd from last bit is 1)
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[(i+8) % 16] = temp[i] ^ op_c[i];
+ } // End of 'for' statement
+ rijndael_input[15] ^= 4;
+ loggers::get_instance().log_to_hexa("fx__f2345: f4/c entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", rijndael_input, 16);
+ r.rijndael_encrypt(rijndael_input, out);
+ loggers::get_instance().log_to_hexa("fx__f2345: f4/d entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", out, 16);
+
+ for (int i = 0; i < 16; i++) {
+ out[i] ^= op_c[i];
+ } // End of 'for' statement
+
+ uint8_t ik[16] = { 0x00 };
+ for (int i = 0; i < 16; i++) {
+ ik[i] = out[i];
+ } // End of 'for' statement
+ loggers::get_instance().log_to_hexa("fx__f2345: f4/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", ik, 16);
+
+ OCTETSTRING os(8, static_cast(&res[0]));
+ p_res = oct2bit(os);
+ os = OCTETSTRING(16, static_cast(&ck[0]));
+ p_ck = oct2bit(os);
+ os = OCTETSTRING(16, static_cast(&ik[0]));
+ p_ik = oct2bit(os);
+ os = OCTETSTRING(6, static_cast(&ak[0]));
+ p_ak = oct2bit(os);
+ loggers::get_instance().log_msg("fx__f2345: p_res: ", bit2oct(p_res));
+ loggers::get_instance().log_msg("fx__f2345: p_ck: ", bit2oct(p_ck));
+ loggers::get_instance().log_msg("fx__f2345: p_ik: ", bit2oct(p_ik));
+ loggers::get_instance().log_msg("fx__f2345: p_ak: ", bit2oct(p_ak));
+
+ return 0;
+ }
+
+ INTEGER fx__f5star(const BITSTRING& p_authK, const BITSTRING& p_rand, BITSTRING& p_ak_s) {
+ loggers::get_instance().log_msg(">>> fx__f5star: p_authK: ", p_authK);
+ loggers::get_instance().log_msg(">>> fx__f5star: p_rand: ", p_rand);
+
+ rijndael r;
+ OCTETSTRING authK = bit2oct(p_authK);
+ r.rijndael_key_schedule(authK);
+ opc op(r, OP);
+ uint8_t op_c[16] = { 0x00 };
+ op.compute_opc(op_c);
+ loggers::get_instance().log_to_hexa("fx__f5star: a entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", op_c, 16);
+
+ OCTETSTRING rand = bit2oct(p_rand);
+ uint8_t rijndael_input[16] = { 0x00 };
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[i] = rand[i].get_octet() ^ op_c[i];
+ } // End of 'for' statement
+ uint8_t temp[16] = { 0x00 };
+ r.rijndael_encrypt(rijndael_input, temp);
+
+ // To obtain output block OUT5: XOR OPc and TEMP, rotate by r5=96, and XOR on the constant c5 (which is all zeroes except that the 3rd from last bit is 1)
+ for (int i = 0; i < 16; i++) {
+ rijndael_input[(i + 4) % 16] = temp[i] ^ op_c[i];
+ } // End of 'for' statement
+ rijndael_input[15] ^= 8;
+ uint8_t out[16] = { 0x00 };
+ loggers::get_instance().log_to_hexa("fx__f5star: f5*/c entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", rijndael_input, 16);
+ r.rijndael_encrypt(rijndael_input, out);
+ loggers::get_instance().log_to_hexa("fx__f5star: f5*/d entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", out, 16);
+ for (int i = 0; i < 16; i++) {
+ out[i] ^= op_c[i];
+ } // End of 'for' statement
+
+ uint8_t ak[6] = { 0x00 };
+ for (int i = 0; i < 6; i++) {
+ ak[i] = out[i];
+ }
+ OCTETSTRING os(6, static_cast(&ak[0]));
+ p_ak_s = oct2bit(os);
+ loggers::get_instance().log_msg("fx__f5star: p_ak: ", bit2oct(p_ak_s));
+
+ return 0;
+ }
+
+} // End of namespace Lib__NG__NAS__CommonFunctions
diff --git a/ccsrc/Externals/NG_security_ext.cc b/ccsrc/Externals/NG_security_ext.cc
new file mode 100644
index 0000000000000000000000000000000000000000..db85ed3c3ee4b783269ce09b83700108c40f8f56
--- /dev/null
+++ b/ccsrc/Externals/NG_security_ext.cc
@@ -0,0 +1,45 @@
+#include
+#include
+#include
+#include
+
+//#include "NG_SecurityDefinitionsAndExternalFunctions.hh"
+#include "NG_NAS_SecurityFunctions.hh"
+//#include "NR_RRC_ASN1_Definitions.hh"
+#include "CommonDefs.hh"
+
+#include "base_time.hh"
+//#include "converter.hh"
+#include "loggers.hh"
+//#include "xml_converters.hh"
+
+
+//namespace NG__SecurityDefinitionsAndExternalFunctions {
+namespace NG__NAS__SecurityFunctions {
+
+ /**
+ * @desc This external function ...
+ * @return The ...
+ * @see fx_get...() return ...
+ */
+
+//BITSTRING fx__NR__AsIntegrityAlgorithm(const OCTETSTRING &a, const NR__RRC__ASN1__Definitions::IntegrityProtAlgorithm& b, const BITSTRING &c, const OCTETSTRING &d, const BITSTRING &e, const INTEGER &f){
+//return int2bit(0, 0);
+//}
+
+OCTETSTRING fx__NG__NasIntegrityAlgorithm(const OCTETSTRING& p_EncodedNasPdu, const BITSTRING& p_IntegrityAlgorithm, const BITSTRING& p_KNASint, const OCTETSTRING& p_NasCount, const BITSTRING& p_BearerId, const INTEGER& p_Direction){
+return int2oct(0, 0);
+}
+
+OCTETSTRING fx__NG__NasCiphering(const OCTETSTRING& p_EncodedNasPdu,const BITSTRING& p_CipheringAlgorithm, const BITSTRING& p_KNASenc, const OCTETSTRING& p_NasCount, const BITSTRING& p_BearerId){
+return int2oct(0, 0);
+}
+
+OCTETSTRING fx__NG__NasDeciphering(const OCTETSTRING& p_CipheredNasMsg, const BITSTRING& p_CipheringAlgorithm, const BITSTRING& p_KNASenc, const OCTETSTRING& p_NasCount, const BITSTRING& p_BearerId){
+return int2oct(0, 0);
+}
+
+
+
+} // namespace NG__NAS__SecurityFunctions
+ // namespace NG__SecurityDefinitionsAndExternalFunctions
diff --git a/ccsrc/Externals/common_ext.cc b/ccsrc/Externals/common_ext.cc
new file mode 100644
index 0000000000000000000000000000000000000000..df78a765345e2167b97611206ad14d5e54e94897
--- /dev/null
+++ b/ccsrc/Externals/common_ext.cc
@@ -0,0 +1,112 @@
+#include
+#include
+#include
+#include
+
+#include "CommonDefs.hh"
+
+#include "base_time.hh"
+//#include "converter.hh"
+#include "loggers.hh"
+
+#include "sha256.hh"
+#include "hmac.hh"
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#define earthRadius 6378137.0L
+#define rbis = ((double)(earthRadius * M_PI / 180))
+
+namespace CommonDefs {
+
+ /**
+ * @desc This external function gets KEY
+ * @return The KEY
+ * @see fx_get...() return UInt64
+ * @note ETSI TS 133 220 V18.3.0 (2024-05) Annex B.2 Generic key derivation function
+ */
+ //INTEGER fx__KeyDerivationFunction(INTEGER const&, BITSTRING const&, OCTETSTRING const&){
+ BITSTRING fx__KeyDerivationFunction(const INTEGER& p__KDF, const BITSTRING& p__Key, const OCTETSTRING& p__String){
+ loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__KDF: ", p__KDF);
+ loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__Key: ", bit2oct(p__Key));
+ loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__String: ", p__String);
+
+ if (p__KDF == 1) { // tsc_KDF_HMAC_SHA_256 see CommonDefs.ttcn
+ hmac h;
+ OCTETSTRING res;
+ if (h.generate(p__String, bit2oct(p__Key), res, false) == -1) {
+ loggers::get_instance().error("fx__KeyDerivationFunction: Key derivation failed");
+ return int2bit(0, 0);
+ }
+
+ loggers::get_instance().log_msg("<<< fx__KeyDerivationFunction: res: ", res);
+ return oct2bit(res);
+ } else {
+ loggers::get_instance().error("fx__KeyDerivationFunction: Unsupported KDF: %d", p__KDF);
+ return int2bit(0, 0);
+ }
+ }
+
+ BITSTRING fx__sha256(const OCTETSTRING& p__String){
+ loggers::get_instance().log_msg(">>> fx__sha256: p__String: ", p__String);
+
+ sha256 sha;
+ OCTETSTRING res;
+ if (sha.generate(p__String, res) == -1) {
+ loggers::get_instance().error("fx__sha256: Key derivation failed");
+ return int2bit(0, 0);
+ }
+
+ loggers::get_instance().log_msg("<<< fx__sha256: res: ", res);
+ return oct2bit(res);
+ }
+
+ /**
+ * @desc This external function gets the current time since 01/01/1970 in UTC format
+ * @return The current time since 01/01/1970 in UTC format in milliseconds
+ * @see fx_getSystemTime() return UInt64
+ */
+ //INTEGER fx__GetSystemTime(CommonDefs::Struct__tm__Type&, INTEGER&){
+ void fx__GetSystemTime(CommonDefs::Struct__tm__Type& p__Struct__tm, INTEGER& p__TimezoneInfo){
+ const time_t t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
+ tm* now = std::localtime(&t);
+ p__Struct__tm = Struct__tm__Type(now->tm_sec, now->tm_min, now->tm_hour, now->tm_mday, now->tm_mon, now->tm_year, now->tm_wday, now->tm_yday, now->tm_isdst);
+ p__TimezoneInfo = 0; // TODO FSCOM
+
+ return;
+ }
+ //void fx__CalculateFCS32(BITSTRING const&) {
+ BITSTRING fx__CalculateFCS32(const BITSTRING& p__TMSI){
+ loggers::get_instance().log_msg(">>> fx__CalculateFCS32: p__TMSI: ", p__TMSI);
+
+ // Sanity checks
+ if (p__TMSI.lengthof() == 0) {
+ loggers::get_instance().error("fx__CalculateFCS32: Empty TMSI");
+ return int2bit(0, 0);
+ }
+
+ OCTETSTRING os = bit2oct(p__TMSI);
+ const unsigned char *data = static_cast(os);
+ if (data == NULL) {
+ loggers::get_instance().error("fx__CalculateFCS32: Failed to get data buffer");
+ return int2bit(0, 0);
+ }
+ unsigned int crc = 0xffffffff;
+ for (size_t i = 0; i < os.lengthof(); i++) {
+ unsigned int val = (crc ^ os[i].get_octet()) & 0xFF;
+ for(size_t j = 0; j < 8; j++){
+ val = val & 0x1 ? (val >> 1) ^ 0xEDB88320 : val >> 1; // 0xEDB88320 is the reverse of 0x04C11DB7
+ } // End of 'for' statement
+ crc = val ^ crc >> 8;
+ } // End of 'for' statement
+ crc ^= 0xffffffff;
+
+ crc = ((crc & 0xFF) << 24) | ((crc & 0xFF00) << 8) | ((crc & 0xFF0000) >> 8) | ((crc & 0xFF000000) >> 24); // Reverse the bits of the CRC value
+ OCTETSTRING crc_os(4, (const unsigned char*)&crc);
+ loggers::get_instance().log_msg("fx__CalculateFCS32: crc: ", crc_os);
+
+ return oct2bit(crc_os);
+ }
+
+} // namespace CommonDefs
diff --git a/ccsrc/Externals/module.mk b/ccsrc/Externals/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..5e20a45e76f592e980602c2265056627faa87800
--- /dev/null
+++ b/ccsrc/Externals/module.mk
@@ -0,0 +1,7 @@
+sources := \
+ common_ext.cc \
+ NG_security_ext.cc \
+ LIB_NG_NAS_CommonFunctions_ext.cc
+
+
+includes := .
diff --git a/ccsrc/Ports/Data/DataPort.cc b/ccsrc/Ports/Data/DataPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9a26e574626c28095212fa2bae9feeaafdea1eb3
--- /dev/null
+++ b/ccsrc/Ports/Data/DataPort.cc
@@ -0,0 +1,73 @@
+#include "DataPort.hh"
+#include "loggers.hh"
+
+namespace AtsImsIot__TestSystem {
+
+ DataPort::DataPort(const char *par_port_name): DataPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("DataPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ DataPort::~DataPort() {
+ loggers::get_instance().log(">>> DataPort::~DataPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void DataPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("DataPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void DataPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void DataPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void DataPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void DataPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void DataPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void DataPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> DataPort::user_map: %s", system_port);
+ } // End of user_map method
+
+ void DataPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> DataPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void DataPort::user_start()
+ {
+ loggers::get_instance().log(">>> DataPort::user_start");
+
+ } // End of user_start method
+
+ void DataPort::user_stop()
+ {
+ loggers::get_instance().log(">>> DataPort::user_stop");
+
+ } // End of user_stop method
+
+}
+
diff --git a/ccsrc/Ports/Data/DataPort.hh b/ccsrc/Ports/Data/DataPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..c9809b1c769863d218e5c1a36334070d36a27983
--- /dev/null
+++ b/ccsrc/Ports/Data/DataPort.hh
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "AtsImsIot_TestSystem.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace AtsImsIot__TestSystem {
+
+ class DataPort : public DataPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ DataPort(const char *par_port_name);
+ ~DataPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const LibSip__SIPTypesAndValues::Request& p_ind, const params& p_params) {};
+ void receiveMsg (const LibSip__SIPTypesAndValues::Response& p_ind, const params& p_params) {};
+ void receiveMsg (const LibMsrp__TypesAndValues::SEND__request& p_ind, const params& p_params) {};
+ void receiveMsg (const LibMsrp__TypesAndValues::RECEIVE__response& p_ind, const params& p_params) {};
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ protected:
+ }; // End of class DataPort
+
+}
+
diff --git a/ccsrc/Ports/Data/module.mk b/ccsrc/Ports/Data/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..b6ee7999e241806b19cd28233c0233bf0d5f6e27
--- /dev/null
+++ b/ccsrc/Ports/Data/module.mk
@@ -0,0 +1,3 @@
+sources := DataPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/ImsMonitorDiameterPort/ImsMonitorDiameterPort.cc b/ccsrc/Ports/ImsMonitorDiameterPort/ImsMonitorDiameterPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..50c6f354a5a13475dc2835b91842bd7a9beee7f3
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorDiameterPort/ImsMonitorDiameterPort.cc
@@ -0,0 +1,102 @@
+#include "ImsMonitorDiameterPort.hh"
+#include "diameter_layer_factory.hh"
+#include "loggers.hh"
+
+namespace AtsImsIot__TestSystem {
+
+ ImsMonitorDiameterPort::ImsMonitorDiameterPort(const char *par_port_name): ImsMonitorDiameterPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("ImsMonitorDiameterPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ ImsMonitorDiameterPort::~ImsMonitorDiameterPort() {
+ loggers::get_instance().log(">>> ImsMonitorDiameterPort::~ImsMonitorDiameterPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void ImsMonitorDiameterPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("ImsMonitorDiameterPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void ImsMonitorDiameterPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void ImsMonitorDiameterPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void ImsMonitorDiameterPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void ImsMonitorDiameterPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void ImsMonitorDiameterPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void ImsMonitorDiameterPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> ImsMonitorDiameterPort::user_map: %s", system_port);
+ // Build layer stack
+ /*params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("ImsMonitorDiameterPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("ImsMonitorDiameterPort::user_map: Invalid stack configuration: %s", it->second.c_str());
+ }
+ static_cast(_layer)->add_upper_port(this);
+
+ } else {*/
+ loggers::get_instance().error("ImsMonitorDiameterPort::user_map: No layers defined in configuration file");
+ /*}*/
+ } // End of user_map method
+
+ void ImsMonitorDiameterPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> ImsMonitorDiameterPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void ImsMonitorDiameterPort::user_start()
+ {
+ loggers::get_instance().log(">>> ImsMonitorDiameterPort::user_start");
+
+ } // End of user_start method
+
+ void ImsMonitorDiameterPort::user_stop()
+ {
+ loggers::get_instance().log(">>> ImsMonitorDiameterPort::user_stop");
+
+ } // End of user_stop method
+
+ void ImsMonitorDiameterPort::receiveMsg (const LibDiameter__TypesAndValues::DIAMETER__MSG& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> ImsMonitorDiameterPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+
+ } // End of method receiveMsg
+
+}
+
diff --git a/ccsrc/Ports/ImsMonitorDiameterPort/ImsMonitorDiameterPort.hh b/ccsrc/Ports/ImsMonitorDiameterPort/ImsMonitorDiameterPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..78759ee35a42d1c5350f8c82ee5253a9892a497e
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorDiameterPort/ImsMonitorDiameterPort.hh
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "AtsImsIot_TestSystem.hh"
+#include "LibDiameter_TypesAndValues.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace AtsImsIot__TestSystem {
+
+ class ImsMonitorDiameterPort : public ImsMonitorDiameterPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ ImsMonitorDiameterPort(const char *par_port_name);
+ ~ImsMonitorDiameterPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const LibDiameter__TypesAndValues::DIAMETER__MSG& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+ }; // End of class ImsMonitorDiameterPort
+
+}
+
diff --git a/ccsrc/Ports/ImsMonitorDiameterPort/module.mk b/ccsrc/Ports/ImsMonitorDiameterPort/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..c189618dce3dfc60855e7ee6e269bc9c25235fb0
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorDiameterPort/module.mk
@@ -0,0 +1,3 @@
+sources := ImsMonitorDiameterPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/ImsMonitorHttpPort/ImsMonitorHttpPort.cc b/ccsrc/Ports/ImsMonitorHttpPort/ImsMonitorHttpPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6684d01917f6e2a874c8865c725bd307e9b9a207
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorHttpPort/ImsMonitorHttpPort.cc
@@ -0,0 +1,107 @@
+#include "ImsMonitorHttpPort.hh"
+
+#include "http_layer_factory.hh"
+#include "ims_http_monitor_layer.hh"
+#include "http_codec_emtel.hh"
+#include "loggers.hh"
+
+namespace AtsIms5gIot__TestSystem {
+
+ ImsMonitorHttpPort::ImsMonitorHttpPort(const char *par_port_name): ImsMonitorHttpPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("ImsMonitorHttpPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ ImsMonitorHttpPort::~ImsMonitorHttpPort() {
+ loggers::get_instance().log(">>> ImsMonitorHttpPort::~ImsMonitorHttpPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void ImsMonitorHttpPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("ImsMonitorHttpPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void ImsMonitorHttpPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void ImsMonitorHttpPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void ImsMonitorHttpPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void ImsMonitorHttpPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void ImsMonitorHttpPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void ImsMonitorHttpPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> ImsMonitorHttpPort::user_map: %s", system_port);
+ // Build layer stack
+ params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("ImsMonitorHttpPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("ImsMonitorHttpPort::user_map: Invalid stack configuration: %s", it->second.c_str());
+ }
+ if (!static_cast(_layer)->set_codec(new http_codec_emtel())) {
+ loggers::get_instance().error("ImsMonitorHttpPort::user_map: Null codec");
+ }
+ static_cast(_layer)->add_upper_port(this);
+ } else {
+ loggers::get_instance().error("ImsMonitorHttpPort::user_map: No layers defined in configuration file");
+ }
+ } // End of user_map method
+
+ void ImsMonitorHttpPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> ImsMonitorHttpPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void ImsMonitorHttpPort::user_start()
+ {
+ loggers::get_instance().log(">>> ImsMonitorHttpPort::user_start");
+
+ } // End of user_start method
+
+ void ImsMonitorHttpPort::user_stop()
+ {
+ loggers::get_instance().log(">>> ImsMonitorHttpPort::user_stop");
+
+ } // End of user_stop method
+
+ void ImsMonitorHttpPort::receiveMsg (const LibHttp__TypesAndValues::HttpMessage& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> ImsMonitorHttpPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+
+ } // End of method receiveMsg
+
+}
+
diff --git a/ccsrc/Ports/ImsMonitorHttpPort/ImsMonitorHttpPort.hh b/ccsrc/Ports/ImsMonitorHttpPort/ImsMonitorHttpPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..f1a79c5b55268cac03f4cf8d99e4ff491f077d09
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorHttpPort/ImsMonitorHttpPort.hh
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "AtsIms5gIot_TestSystem.hh"
+#include "LibHttp_TypesAndValues.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace LibHttp__TypesAndValues {
+ class HttpMessage;
+}
+
+namespace AtsIms5gIot__TestSystem {
+
+ class ImsMonitorHttpPort : public ImsMonitorHttpPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ ImsMonitorHttpPort(const char *par_port_name);
+ ~ImsMonitorHttpPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const LibHttp__TypesAndValues::HttpMessage& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+ }; // End of class ImsMonitorHttpPort
+
+}
+
diff --git a/ccsrc/Ports/ImsMonitorHttpPort/module.mk b/ccsrc/Ports/ImsMonitorHttpPort/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..375e6e583fa52811652c41e64f2fb108a5b935c0
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorHttpPort/module.mk
@@ -0,0 +1,3 @@
+sources := ImsMonitorHttpPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/ImsMonitorNgapPort/ImsMonitorNgapPort.cc b/ccsrc/Ports/ImsMonitorNgapPort/ImsMonitorNgapPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e86f1dc582db4b5a5df5e17edf9bc80c0a9323d2
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorNgapPort/ImsMonitorNgapPort.cc
@@ -0,0 +1,108 @@
+#include "ImsMonitorNgapPort.hh"
+
+#include "NGAP_PDU_Descriptions.hh"
+#include "ngap_layer_factory.hh"
+#include "layer.hh"
+#include "params.hh"
+
+#include "loggers.hh"
+
+namespace AtsIms5gIot__TestSystem {
+
+ ImsMonitorNgapPort::ImsMonitorNgapPort(const char *par_port_name): ImsMonitorNgapPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("ImsMonitorNgapPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ ImsMonitorNgapPort::~ImsMonitorNgapPort() {
+ loggers::get_instance().log(">>> ImsMonitorNgapPort::~ImsMonitorNgapPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void ImsMonitorNgapPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("ImsMonitorNgapPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void ImsMonitorNgapPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void ImsMonitorNgapPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void ImsMonitorNgapPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void ImsMonitorNgapPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void ImsMonitorNgapPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void ImsMonitorNgapPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> ImsMonitorNgapPort::user_map: %s", system_port);
+
+ // Build layer stack
+ params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("NGAPPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("NGAPPort::user_map: Invalid stack configurationi - NOT SCTP: %s", it->second.c_str());
+ }
+ static_cast(_layer)->add_upper_port(this);
+ } else {
+ loggers::get_instance().error("NGAPPort::user_map: No layers defined in configuration file");
+ }
+ } // End of user_map method
+
+ void ImsMonitorNgapPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> ImsMonitorNgapPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void ImsMonitorNgapPort::user_start()
+ {
+ loggers::get_instance().log(">>> ImsMonitorNgapPort::user_start");
+
+ } // End of user_start method
+
+ void ImsMonitorNgapPort::user_stop()
+ {
+ loggers::get_instance().log(">>> ImsMonitorNgapPort::user_stop");
+
+ } // End of user_stop method
+
+ void ImsMonitorNgapPort::receiveMsg (const NGAP__PDU__Descriptions::NGAP__PDU& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> ImsMonitorNgapPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+
+ } // End of method receiveMsg
+
+}
+
diff --git a/ccsrc/Ports/ImsMonitorNgapPort/ImsMonitorNgapPort.hh b/ccsrc/Ports/ImsMonitorNgapPort/ImsMonitorNgapPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..ea95ae171da1bc02411846772f14ff7563550d04
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorNgapPort/ImsMonitorNgapPort.hh
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "AtsIms5gIot_TestSystem.hh"
+#include "NGAP_PDU_Descriptions.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace NGAP__PDU__Descriptions {
+ class NGAP__PDU;
+}
+
+namespace AtsIms5gIot__TestSystem {
+
+ class ImsMonitorNgapPort : public ImsMonitorNgapPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ ImsMonitorNgapPort(const char *par_port_name);
+ ~ImsMonitorNgapPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const NGAP__PDU__Descriptions::NGAP__PDU& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+ }; // End of class ImsMonitorNgapPort
+
+}
+
diff --git a/ccsrc/Ports/ImsMonitorNgapPort/module.mk b/ccsrc/Ports/ImsMonitorNgapPort/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..f76b9f6d79c005fd6b37c9a440d08daeb1ff7ee6
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorNgapPort/module.mk
@@ -0,0 +1,3 @@
+sources := ImsMonitorNgapPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/ImsMonitorSipPort/ImsMonitorSipPort.cc b/ccsrc/Ports/ImsMonitorSipPort/ImsMonitorSipPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7776a1ef2451f4fbbbcb1a1cdcfc8348a6760597
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorSipPort/ImsMonitorSipPort.cc
@@ -0,0 +1,134 @@
+#include "ImsMonitorSipPort.hh"
+#include "sip_layer_factory.hh"
+#include "loggers.hh"
+
+namespace AtsImsIot__TestSystem {
+
+ ImsMonitorSipPort::ImsMonitorSipPort(const char *par_port_name): ImsMonitorSipPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("ImsMonitorSipPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ ImsMonitorSipPort::~ImsMonitorSipPort() {
+ loggers::get_instance().log(">>> ImsMonitorSipPort::~ImsMonitorSipPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void ImsMonitorSipPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("ImsMonitorSipPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void ImsMonitorSipPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void ImsMonitorSipPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void ImsMonitorSipPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void ImsMonitorSipPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void ImsMonitorSipPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void ImsMonitorSipPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> ImsMonitorSipPort::user_map: %s", system_port);
+ // Build layer stack
+ /*params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("ImsMonitorSipPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("ImsMonitorSipPort::user_map: Invalid stack configuration: %s", it->second.c_str());
+ }
+ static_cast(_layer)->add_upper_port(this);
+
+ } else {*/
+ loggers::get_instance().error("ImsMonitorSipPort::user_map: No layers defined in configuration file");
+ /*}*/
+ } // End of user_map method
+
+ void ImsMonitorSipPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> ImsMonitorSipPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void ImsMonitorSipPort::user_start()
+ {
+ loggers::get_instance().log(">>> ImsMonitorSipPort::user_start");
+
+ } // End of user_start method
+
+ void ImsMonitorSipPort::user_stop()
+ {
+ loggers::get_instance().log(">>> ImsMonitorSipPort::user_stop");
+
+ } // End of user_stop method
+
+ void ImsMonitorSipPort::receiveMsg (const LibSip__SIPTypesAndValues::Request& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> ImsMonitorSipPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+ } // End of method receiveMsg
+
+ void ImsMonitorSipPort::receiveMsg (const LibSip__SIPTypesAndValues::Response& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> ImsMonitorSipPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+ } // End of method receiveMsg
+
+ void ImsMonitorSipPort::receiveMsg (const LibMsrp__TypesAndValues::SEND__request& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> ImsMonitorSipPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+ } // End of method receiveMsg
+
+ void ImsMonitorSipPort::receiveMsg (const LibMsrp__TypesAndValues::RECEIVE__response& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> ImsMonitorSipPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+ } // End of method receiveMsg
+
+}
+
diff --git a/ccsrc/Ports/ImsMonitorSipPort/ImsMonitorSipPort.hh b/ccsrc/Ports/ImsMonitorSipPort/ImsMonitorSipPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..93f6d574344ca7ddb40486147414c05b0a5a767f
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorSipPort/ImsMonitorSipPort.hh
@@ -0,0 +1,50 @@
+#pragma once
+
+#include "AtsImsIot_TestSystem.hh"
+#include "LibSip_Interface.hh"
+#include "LibMsrp_TypesAndValues.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace LibSip__SIPTypesAndValues {
+ class REGISTER__Request;
+}
+
+namespace AtsImsIot__TestSystem {
+
+ class ImsMonitorSipPort : public ImsMonitorSipPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ ImsMonitorSipPort(const char *par_port_name);
+ ~ImsMonitorSipPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const LibSip__SIPTypesAndValues::Request& p_ind, const params& p_params);
+ void receiveMsg (const LibSip__SIPTypesAndValues::Response& p_ind, const params& p_params);
+ void receiveMsg (const LibMsrp__TypesAndValues::SEND__request& p_ind, const params& p_params);
+ void receiveMsg (const LibMsrp__TypesAndValues::RECEIVE__response& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ }; // End of class ImsMonitorSipPort
+
+}
+
diff --git a/ccsrc/Ports/ImsMonitorSipPort/module.mk b/ccsrc/Ports/ImsMonitorSipPort/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..e65eb1e35331f3c34bc9aca925c3fcc4e2966b0c
--- /dev/null
+++ b/ccsrc/Ports/ImsMonitorSipPort/module.mk
@@ -0,0 +1,3 @@
+sources := ImsMonitorSipPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/LibDiameter/DiameterPort.cc b/ccsrc/Ports/LibDiameter/DiameterPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7900fb417ada69a3a1f89c04ffdf3af971b1af81
--- /dev/null
+++ b/ccsrc/Ports/LibDiameter/DiameterPort.cc
@@ -0,0 +1,113 @@
+#include "DiameterPort.hh"
+#include "diameter_layer_factory.hh"
+#include "loggers.hh"
+
+namespace LibDiameter__Interface {
+
+ DiameterPort::DiameterPort(const char *par_port_name): DiameterPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("DiameterPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ DiameterPort::~DiameterPort() {
+ loggers::get_instance().log(">>> DiameterPort::~DiameterPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void DiameterPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("DiameterPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void DiameterPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void DiameterPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void DiameterPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void DiameterPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void DiameterPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void DiameterPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> DiameterPort::user_map: %s", system_port);
+ // Build layer stack
+ params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("DiameterPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("DiameterPort::user_map: Invalid stack configuration: %s", it->second.c_str());
+ }
+ static_cast(_layer)->add_upper_port(this);
+
+ } else {
+ loggers::get_instance().error("DiameterPort::user_map: No layers defined in configuration file");
+ }
+ } // End of user_map method
+
+ void DiameterPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> DiameterPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void DiameterPort::user_start()
+ {
+ loggers::get_instance().log(">>> DiameterPort::user_start");
+
+ } // End of user_start method
+
+ void DiameterPort::user_stop()
+ {
+ loggers::get_instance().log(">>> DiameterPort::user_stop");
+
+ } // End of user_stop method
+
+ void DiameterPort::receiveMsg (const LibDiameter__TypesAndValues::DIAMETER__MSG& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> DiameterPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+
+ } // End of method receiveMsg
+
+ void DiameterPort::outgoing_send(const LibDiameter__TypesAndValues::DIAMETER__MSG& send_par)
+ {
+ loggers::get_instance().log_msg(">>> DiameterPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ } // End of outgoing_send
+
+}
+
diff --git a/ccsrc/Ports/LibDiameter/DiameterPort.hh b/ccsrc/Ports/LibDiameter/DiameterPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..523b9d949c9fb58176af727ffb040f4572822fd8
--- /dev/null
+++ b/ccsrc/Ports/LibDiameter/DiameterPort.hh
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "LibDiameter_Interface.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace LibDiameter__Interface {
+
+ class DiameterPort : public DiameterPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ DiameterPort(const char *par_port_name);
+ ~DiameterPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const LibDiameter__TypesAndValues::DIAMETER__MSG& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ protected:
+ virtual void outgoing_send(const LibDiameter__TypesAndValues::DIAMETER__MSG& send_par);
+ }; // End of class DiameterPort
+
+}
+
diff --git a/ccsrc/Ports/LibDiameter/LowerLayerPPort.cc b/ccsrc/Ports/LibDiameter/LowerLayerPPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8978f6daa70e8467c4395598d7ef88881a72b850
--- /dev/null
+++ b/ccsrc/Ports/LibDiameter/LowerLayerPPort.cc
@@ -0,0 +1,113 @@
+#include "LowerLayerPPort.hh"
+#include "lower_layer_pport_layer_factory.hh"
+#include "loggers.hh"
+
+namespace LibDiameter__Interface {
+
+ LowerLayerPPort::LowerLayerPPort(const char *par_port_name): LowerLayerPPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("LowerLayerPPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ LowerLayerPPort::~LowerLayerPPort() {
+ loggers::get_instance().log(">>> LowerLayerPPort::~LowerLayerPPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void LowerLayerPPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("LowerLayerPPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void LowerLayerPPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void LowerLayerPPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void LowerLayerPPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void LowerLayerPPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void LowerLayerPPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void LowerLayerPPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> LowerLayerPPort::user_map: %s", system_port);
+ // Build layer stack
+ params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("LowerLayerPPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("LowerLayerPPort::user_map: Invalid stack configuration: %s", it->second.c_str());
+ }
+ static_cast(_layer)->add_upper_port(this);
+
+ } else {
+ loggers::get_instance().error("LowerLayerPPort::user_map: No layers defined in configuration file");
+ }
+ } // End of user_map method
+
+ void LowerLayerPPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> LowerLayerPPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void LowerLayerPPort::user_start()
+ {
+ loggers::get_instance().log(">>> LowerLayerPPort::user_start");
+
+ } // End of user_start method
+
+ void LowerLayerPPort::user_stop()
+ {
+ loggers::get_instance().log(">>> LowerLayerPPort::user_stop");
+
+ } // End of user_stop method
+
+ void LowerLayerPPort::receiveMsg (const LibDiameter__TypesAndValues::Lower__Layer__Primitive& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> LowerLayerPPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+
+ } // End of method receiveMsg
+
+ void LowerLayerPPort::outgoing_send(const LibDiameter__TypesAndValues::Lower__Layer__Primitive& send_par)
+ {
+ loggers::get_instance().log_msg(">>> LowerLayerPPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ } // End of outgoing_send
+
+}
+
diff --git a/ccsrc/Ports/LibDiameter/LowerLayerPPort.hh b/ccsrc/Ports/LibDiameter/LowerLayerPPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..4f517f515a21e96b654a8cc6583243e2517960c2
--- /dev/null
+++ b/ccsrc/Ports/LibDiameter/LowerLayerPPort.hh
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "LibDiameter_Interface.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace LibDiameter__Interface {
+
+ class LowerLayerPPort : public LowerLayerPPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ LowerLayerPPort(const char *par_port_name);
+ ~LowerLayerPPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const LibDiameter__TypesAndValues::Lower__Layer__Primitive& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ protected:
+ virtual void outgoing_send(const LibDiameter__TypesAndValues::Lower__Layer__Primitive& send_par);
+ }; // End of class LowerLayerPPort
+
+}
+
diff --git a/ccsrc/Ports/LibDiameter/module.mk b/ccsrc/Ports/LibDiameter/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..3d9debd99e219570ebc2a99aa5f4509cd807aaa0
--- /dev/null
+++ b/ccsrc/Ports/LibDiameter/module.mk
@@ -0,0 +1,3 @@
+sources := DiameterPort.cc LowerLayerPPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/LibHttp/HttpPort.cc b/ccsrc/Ports/LibHttp/HttpPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..30b524f94c26e02a0743a3d86b26df57425e565a
--- /dev/null
+++ b/ccsrc/Ports/LibHttp/HttpPort.cc
@@ -0,0 +1,117 @@
+#include "HttpPort.hh"
+#include "http_layer_factory.hh"
+#include "http_layer.hh"
+#include "http_codec_emtel.hh"
+#include "loggers.hh"
+
+#include "LibHttp_TypesAndValues.hh"
+
+namespace LibHttp__TestSystem {
+
+ HttpPort::HttpPort(const char *par_port_name): HttpPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("HttpPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ HttpPort::~HttpPort() {
+ loggers::get_instance().log(">>> HttpPort::~HttpPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void HttpPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("HttpPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void HttpPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void HttpPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void HttpPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void HttpPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void HttpPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void HttpPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> HttpPort::user_map: %s", system_port);
+ // Build layer stack
+ params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("HttpPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("HttpPort::user_map: Invalid stack configuration: %s", it->second.c_str());
+ }
+ if (!static_cast(_layer)->set_codec(new http_codec_emtel())) {
+ loggers::get_instance().error("HttpPort::user_map: Null codec");
+ }
+ static_cast(_layer)->add_upper_port(this);
+ } else {
+ loggers::get_instance().error("HttpPort::user_map: No layers defined in configuration file");
+ }
+ } // End of user_map method
+
+ void HttpPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> HttpPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void HttpPort::user_start()
+ {
+ loggers::get_instance().log(">>> HttpPort::user_start");
+
+ } // End of user_start method
+
+ void HttpPort::user_stop()
+ {
+ loggers::get_instance().log(">>> HttpPort::user_stop");
+
+ } // End of user_stop method
+
+ void HttpPort::outgoing_send(const LibHttp__TypesAndValues::HttpMessage& send_par)
+ {
+ loggers::get_instance().log_msg(">>> HttpPort::outgoing_send: payload=", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+ void HttpPort::receiveMsg (const LibHttp__TypesAndValues::HttpMessage& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> HttpPort::receive_msg: ", p_ind);
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+ }
+
+} // End of namespace LibHttp__TestSystem
+
diff --git a/ccsrc/Ports/LibHttp/HttpPort.hh b/ccsrc/Ports/LibHttp/HttpPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..7d8b1af81630f28bced659562603e38caa50e05e
--- /dev/null
+++ b/ccsrc/Ports/LibHttp/HttpPort.hh
@@ -0,0 +1,46 @@
+#pragma once
+
+#include "LibHttp_TestSystem.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace LibHttp__TypesAndValues {
+ class HttpMessage;
+}
+
+namespace LibHttp__TestSystem {
+
+ class HttpPort : public HttpPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ HttpPort(const char *par_port_name);
+ ~HttpPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+ void receiveMsg (const LibHttp__TypesAndValues::HttpMessage& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ protected:
+ void outgoing_send(const LibHttp__TypesAndValues::HttpMessage& send_par);
+ }; // End of class HttpPort
+
+} // End of namespace LibHttp__TestSystem
+
diff --git a/ccsrc/Ports/LibHttp/module.mk b/ccsrc/Ports/LibHttp/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..0fba8bd2e9442497d91fa111d95c889d4d57e139
--- /dev/null
+++ b/ccsrc/Ports/LibHttp/module.mk
@@ -0,0 +1,3 @@
+sources := HttpPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/LibIot/AdapterConfigPort.cc b/ccsrc/Ports/LibIot/AdapterConfigPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7a0d97db0633fcef746161df83e0838c295e752e
--- /dev/null
+++ b/ccsrc/Ports/LibIot/AdapterConfigPort.cc
@@ -0,0 +1,77 @@
+#include
+
+#include "loggers.hh"
+#include "registration.hh"
+
+#include "AdapterConfigPort.hh"
+
+//=============================================================================
+namespace LibIot__TestInterface {
+
+ AdapterConfigPort::AdapterConfigPort(const char *par_port_name) : AdapterConfigPort_BASE(par_port_name), _params() {
+ loggers::get_instance().log("AdapterConfigPort::AdapterConfigPort");
+ }
+
+ AdapterConfigPort::~AdapterConfigPort() {}
+
+ void AdapterConfigPort::set_parameter(const char *parameter_name, const char *parameter_value) {
+ loggers::get_instance().log("AdapterConfigPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ }
+
+ /*void AdapterConfigPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void AdapterConfigPort::Handle_Fd_Event_Error(int /*fd*/) {}
+
+ void AdapterConfigPort::Handle_Fd_Event_Writable(int /*fd*/) {}
+
+ void AdapterConfigPort::Handle_Fd_Event_Readable(int /*fd*/) {}
+
+ /*void AdapterConfigPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void AdapterConfigPort::user_map(const char *system_port) { loggers::get_instance().log(">>> AdapterConfigPort::user_map: %s", system_port); }
+
+ void AdapterConfigPort::user_unmap(const char *system_port) { loggers::get_instance().log(">>> AdapterConfigPort::user_unmap: %s", system_port); }
+
+ void AdapterConfigPort::user_start() {}
+
+ void AdapterConfigPort::user_stop() {}
+
+ void AdapterConfigPort::outgoing_send(const LibIot__TypesAndValues::GeneralConfigurationReq& send_par) {
+ loggers::get_instance().log_msg(">>> AdapterConfigPort::outgoing_send: ", send_par);
+//{ captureProcessIpAddress := "127.0.0.1", captureProcessPort := 5501, captureMode := { offlineCapture := { offset := { seconds := 0, microseconds := 0 }, captureSource := { sessionsPath := "C:/cygwin/tmp/IMS-UE_tool_pcaps", mergeFileList := { mergeFileList := { }, mergeFilePath := "", mergeToolPath := "" } } } }, eutInfoList := omit }
+
+ LibIot__TypesAndValues::GeneralConfigurationRsp response;
+ response.status() = LibIot__TypesAndValues::Status(LibCommon__VerdictControl::FncRetCode::e__success, OPTIONAL("Configuration successful"));
+ loggers::get_instance().log_msg("AdapterConfigPort::outgoing_send: Send response: ", response);
+ incoming_message(response);
+ }
+
+ void AdapterConfigPort::outgoing_send(const LibIot__TypesAndValues::SetFilterReq& send_par) {
+ loggers::get_instance().log_msg(">>> AdapterConfigPort::outgoing_send: ", send_par);
+
+ LibIot__TypesAndValues::SetFilterRsp response;
+ response.status() = LibIot__TypesAndValues::Status(LibCommon__VerdictControl::FncRetCode::e__success, OPTIONAL("Configuration successful"));
+ loggers::get_instance().log_msg("AdapterConfigPort::outgoing_send: Send response: ", response);
+ incoming_message(response);
+ }
+
+ void AdapterConfigPort::outgoing_send(const LibIot__TypesAndValues::StartTrafficCaptureReq& send_par) {
+ loggers::get_instance().log_msg(">>> AdapterConfigPort::outgoing_send: ", send_par);
+
+ LibIot__TypesAndValues::StartTrafficCaptureRsp response;
+ response.status() = LibIot__TypesAndValues::Status(LibCommon__VerdictControl::FncRetCode::e__success, OPTIONAL("Configuration successful"));
+ loggers::get_instance().log_msg("AdapterConfigPort::outgoing_send: Send response: ", response);
+ incoming_message(response);
+ }
+
+ void AdapterConfigPort::outgoing_send(const LibIot__TypesAndValues::StopTrafficCaptureReq& send_par) {
+ loggers::get_instance().log_msg(">>> AdapterConfigPort::outgoing_send: ", send_par);
+
+ LibIot__TypesAndValues::StopTrafficCaptureRsp response;
+ response.status() = LibIot__TypesAndValues::Status(LibCommon__VerdictControl::FncRetCode::e__success, OPTIONAL("Configuration successful"));
+ loggers::get_instance().log_msg("AdapterConfigPort::outgoing_send: Send response: ", response);
+ incoming_message(response);
+ }
+
+} // namespace LibIot__TestInterface
diff --git a/ccsrc/Ports/LibIot/AdapterConfigPort.hh b/ccsrc/Ports/LibIot/AdapterConfigPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..2143db5d58f568205583d3fcffcf16c5bd7467db
--- /dev/null
+++ b/ccsrc/Ports/LibIot/AdapterConfigPort.hh
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "LibIot_TestInterface.hh"
+
+#include "params.hh"
+
+namespace LibIot__TestInterface {
+
+ class AdapterConfigPort : public AdapterConfigPort_BASE {
+ params _params;
+
+ public:
+ AdapterConfigPort(const char *par_port_name = NULL);
+ ~AdapterConfigPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ void outgoing_send(const LibIot__TypesAndValues::GeneralConfigurationReq &send_par);
+
+ void outgoing_send(const LibIot__TypesAndValues::SetFilterReq &send_par);
+
+ void outgoing_send(const LibIot__TypesAndValues::StartTrafficCaptureReq &send_par);
+
+ void outgoing_send(const LibIot__TypesAndValues::StopTrafficCaptureReq &send_par);
+ };
+
+} // namespace LibIot__TestInterface
+
diff --git a/ccsrc/Ports/LibIot/EquipmentAccessPort.cc b/ccsrc/Ports/LibIot/EquipmentAccessPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..78e945b24eb183481f4cf461af282a95fc535528
--- /dev/null
+++ b/ccsrc/Ports/LibIot/EquipmentAccessPort.cc
@@ -0,0 +1,113 @@
+#include "EquipmentAccessPort.hh"
+#include "upper_tester_layer_factory.hh"
+#include "loggers.hh"
+
+namespace LibIot__TestInterface {
+
+ EquipmentAccessPort::EquipmentAccessPort(const char *par_port_name): EquipmentAccessPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("EquipmentAccessPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ EquipmentAccessPort::~EquipmentAccessPort() {
+ loggers::get_instance().log(">>> EquipmentAccessPort::~EquipmentAccessPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void EquipmentAccessPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("EquipmentAccessPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void EquipmentAccessPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void EquipmentAccessPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void EquipmentAccessPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void EquipmentAccessPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void EquipmentAccessPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void EquipmentAccessPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> EquipmentAccessPort::user_map: %s", system_port);
+ // Build layer stack
+ params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("EquipmentAccessPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("EquipmentAccessPort::user_map: Invalid stack configuration: %s", it->second.c_str());
+ }
+ static_cast(_layer)->add_upper_port(this);
+
+ } else {
+ loggers::get_instance().error("EquipmentAccessPort::user_map: No layers defined in configuration file");
+ }
+ } // End of user_map method
+
+ void EquipmentAccessPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> EquipmentAccessPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void EquipmentAccessPort::user_start()
+ {
+ loggers::get_instance().log(">>> EquipmentAccessPort::user_start");
+
+ } // End of user_start method
+
+ void EquipmentAccessPort::user_stop()
+ {
+ loggers::get_instance().log(">>> EquipmentAccessPort::user_stop");
+
+ } // End of user_stop method
+
+ void EquipmentAccessPort::receiveMsg (const LibUpperTester::EquipmentOperationRsp& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> EquipmentAccessPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+
+ } // End of method receiveMsg
+
+ void EquipmentAccessPort::outgoing_send(const LibUpperTester::EquipmentOperationReq& send_par)
+ {
+ loggers::get_instance().log_msg(">>> EquipmentAccessPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ } // End of outgoing_send
+
+}
+
diff --git a/ccsrc/Ports/LibIot/EquipmentAccessPort.hh b/ccsrc/Ports/LibIot/EquipmentAccessPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..297ae4faae4151ffffaf7e1e14f214af4221d5e6
--- /dev/null
+++ b/ccsrc/Ports/LibIot/EquipmentAccessPort.hh
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "LibIot_TestInterface.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace LibIot__TestInterface {
+
+ class EquipmentAccessPort : public EquipmentAccessPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ EquipmentAccessPort(const char *par_port_name);
+ ~EquipmentAccessPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const LibUpperTester::EquipmentOperationRsp& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ protected:
+ virtual void outgoing_send(const LibUpperTester::EquipmentOperationReq& send_par);
+ }; // End of class EquipmentAccessPort
+
+}
+
diff --git a/ccsrc/Ports/LibIot/module.mk b/ccsrc/Ports/LibIot/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..8c24c4b66a3baa366dea75935e683d25be937014
--- /dev/null
+++ b/ccsrc/Ports/LibIot/module.mk
@@ -0,0 +1,3 @@
+sources := EquipmentAccessPort.cc AdapterConfigPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/LibSip/OperatorPort.hh b/ccsrc/Ports/LibSip/OperatorPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..a44d31675dfb7db40db280178d9149691301865c
--- /dev/null
+++ b/ccsrc/Ports/LibSip/OperatorPort.hh
@@ -0,0 +1,31 @@
+
+
+#pragma once
+
+#include "LibSip_Interface.hh"
+
+namespace LibSip__Interface {
+
+ class OperatorPort : public OperatorPort_BASE {
+ public:
+ OperatorPort(const char *par_port_name): OperatorPort_BASE(par_port_name) { };
+ ~OperatorPort() { };
+
+ protected:
+ virtual void outgoing_call(const s__SIP__conversation_call& call_par) { };
+ virtual void outgoing_call(const s__SIP__ringing_call& call_par) { };
+ virtual void outgoing_call(const s__SIP__announcementA_call& call_par) { };
+ virtual void outgoing_call(const s__SIP__announcementB_call& call_par) { };
+ virtual void outgoing_call(const s__SIP__announcement_call& call_par) { };
+ virtual void outgoing_call(const s__SIP__voiceMessage_call& call_par) { };
+ virtual void outgoing_call(const s__SIP__mediastopped_call& call_par) { };
+ virtual void outgoing_reply(const s__SIP__conversation_reply& reply_par) { };
+ virtual void outgoing_reply(const s__SIP__ringing_reply& reply_par) { };
+ virtual void outgoing_reply(const s__SIP__announcementA_reply& reply_par) { };
+ virtual void outgoing_reply(const s__SIP__announcementB_reply& reply_par) { };
+ virtual void outgoing_reply(const s__SIP__announcement_reply& reply_par) { };
+ virtual void outgoing_reply(const s__SIP__voiceMessage_reply& reply_par) { };
+ virtual void outgoing_reply(const s__SIP__mediastopped_reply& reply_par) { };
+ }; // End of class OperatorPort
+
+}
diff --git a/ccsrc/Ports/LibSip/SipPort.cc b/ccsrc/Ports/LibSip/SipPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cb54e167f57405bc51491b2bbbe4718ef96f800e
--- /dev/null
+++ b/ccsrc/Ports/LibSip/SipPort.cc
@@ -0,0 +1,246 @@
+#include "SipPort.hh"
+#include "sip_layer_factory.hh"
+#include "loggers.hh"
+
+namespace LibSip__Interface {
+
+ SipPort::SipPort(const char *par_port_name): SipPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("SipPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ SipPort::~SipPort() {
+ loggers::get_instance().log(">>> SipPort::~SipPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void SipPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("SipPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void SipPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void SipPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void SipPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void SipPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void SipPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void SipPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> SipPort::user_map: %s", system_port);
+ // Build layer stack
+ params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("SipPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("SipPort::user_map: Invalid stack configuration: %s", it->second.c_str());
+ }
+ static_cast(_layer)->add_upper_port(this);
+
+ } else {
+ loggers::get_instance().error("SipPort::user_map: No layers defined in configuration file");
+ }
+ } // End of user_map method
+
+ void SipPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> SipPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void SipPort::user_start()
+ {
+ loggers::get_instance().log(">>> SipPort::user_start");
+
+ } // End of user_start method
+
+ void SipPort::user_stop()
+ {
+ loggers::get_instance().log(">>> SipPort::user_stop");
+
+ } // End of user_stop method
+
+ void SipPort::receiveMsg (const LibSip__SIPTypesAndValues::Request& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> SipPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::REGISTER__E) {
+ incoming_message(LibSip__SIPTypesAndValues::REGISTER__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::INVITE__E) {
+ incoming_message(LibSip__SIPTypesAndValues::INVITE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::SUBSCRIBE__E) {
+ incoming_message(LibSip__SIPTypesAndValues::SUBSCRIBE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::NOTIFY__E) {
+ incoming_message(LibSip__SIPTypesAndValues::NOTIFY__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::BYE__E) {
+ incoming_message(LibSip__SIPTypesAndValues::BYE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::INFO__E) {
+ incoming_message(LibSip__SIPTypesAndValues::INFO__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::OPTIONS__E) {
+ incoming_message(LibSip__SIPTypesAndValues::OPTIONS__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::MESSAGE__E) {
+ incoming_message(LibSip__SIPTypesAndValues::MESSAGE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::CANCEL__E) {
+ incoming_message(LibSip__SIPTypesAndValues::CANCEL__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::ACK__E) {
+ incoming_message(LibSip__SIPTypesAndValues::ACK__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+ } else {
+ incoming_message(p_ind);
+ }
+ } // End of method receiveMsg
+
+ void SipPort::receiveMsg (const LibSip__SIPTypesAndValues::Response& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> SipPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+ } // End of method receiveMsg
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::INVITE__Request& send_par, const Address4SIP *destination_address)
+ {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ } // End of outgoing_send
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::ACK__Request& send_par, const Address4SIP *destination_address)
+ {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ } // End of outgoing_send
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::REGISTER__Request& send_par, const Address4SIP *destination_address) {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::SUBSCRIBE__Request& send_par, const Address4SIP *destination_address) {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::MESSAGE__Request& send_par, const Address4SIP *destination_address) {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::OPTIONS__Request& send_par, const Address4SIP *destination_address) {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::BYE__Request& send_par, const Address4SIP *destination_address) {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::CANCEL__Request& send_par, const Address4SIP *destination_address) {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::NOTIFY__Request& send_par, const Address4SIP *destination_address) {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::INFO__Request& send_par, const Address4SIP *destination_address) {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+ void SipPort::outgoing_send(const LibSip__SIPTypesAndValues::Response& send_par, const Address4SIP *destination_address) {
+ loggers::get_instance().log_msg(">>> SipPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ }
+
+}
+
diff --git a/ccsrc/Ports/LibSip/SipPort.hh b/ccsrc/Ports/LibSip/SipPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..fc2edfaf56e68bf3598a5d14468a270c210a1bd3
--- /dev/null
+++ b/ccsrc/Ports/LibSip/SipPort.hh
@@ -0,0 +1,64 @@
+#pragma once
+
+#include "LibSip_Interface.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace LibSip__SIPTypesAndValues {
+ class REGISTER__Request;
+}
+
+namespace LibSip__Interface {
+
+ class SipPort : public SipPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ SipPort(const char *par_port_name);
+ ~SipPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const LibSip__SIPTypesAndValues::Request& p_ind, const params& p_params);
+ void receiveMsg (const LibSip__SIPTypesAndValues::Response& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ protected:
+ virtual void outgoing_send(const LibSip__SIPTypesAndValues::Request& send_par, const Address4SIP *destination_address) { };
+ void outgoing_send(const LibSip__SIPTypesAndValues::REGISTER__Request& send_par, const Address4SIP *destination_address);
+ void outgoing_send(const LibSip__SIPTypesAndValues::INVITE__Request& send_par, const Address4SIP *destination_address);
+ void outgoing_send(const LibSip__SIPTypesAndValues::OPTIONS__Request& send_par, const Address4SIP *destination_address);
+ void outgoing_send(const LibSip__SIPTypesAndValues::BYE__Request& send_par, const Address4SIP *destination_address);
+ void outgoing_send(const LibSip__SIPTypesAndValues::CANCEL__Request& send_par, const Address4SIP *destination_address);
+ void outgoing_send(const LibSip__SIPTypesAndValues::ACK__Request& send_par, const Address4SIP *destination_address);
+ virtual void outgoing_send(const LibSip__SIPTypesAndValues::PRACK__Request& send_par, const Address4SIP *destination_address) { };
+ void outgoing_send(const LibSip__SIPTypesAndValues::NOTIFY__Request& send_par, const Address4SIP *destination_address);
+ void outgoing_send(const LibSip__SIPTypesAndValues::SUBSCRIBE__Request& send_par, const Address4SIP *destination_address);
+ virtual void outgoing_send(const LibSip__SIPTypesAndValues::PUBLISH__Request& send_par, const Address4SIP *destination_address) { };
+ virtual void outgoing_send(const LibSip__SIPTypesAndValues::UPDATE__Request& send_par, const Address4SIP *destination_address) { };
+ virtual void outgoing_send(const LibSip__SIPTypesAndValues::REFER__Request& send_par, const Address4SIP *destination_address) { };
+ void outgoing_send(const LibSip__SIPTypesAndValues::MESSAGE__Request& send_par, const Address4SIP *destination_address);
+ void outgoing_send(const LibSip__SIPTypesAndValues::INFO__Request& send_par, const Address4SIP *destination_address);
+ void outgoing_send(const LibSip__SIPTypesAndValues::Response& send_par, const Address4SIP *destination_address);
+ virtual void outgoing_send(const CHARSTRING& send_par, const Address4SIP *destination_address) { };
+ }; // End of class SipPort
+
+}
+
diff --git a/ccsrc/Ports/LibSip/module.mk b/ccsrc/Ports/LibSip/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..7c599702e1dfe14d409117e77e97eed48f9d306f
--- /dev/null
+++ b/ccsrc/Ports/LibSip/module.mk
@@ -0,0 +1,3 @@
+sources := SipPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/Naptr/NaptrPort.cc b/ccsrc/Ports/Naptr/NaptrPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ee3b9bf069c86e4a648981099b41a5f654e09e4b
--- /dev/null
+++ b/ccsrc/Ports/Naptr/NaptrPort.cc
@@ -0,0 +1,113 @@
+#include "NaptrPort.hh"
+#include "naptrPort_layer_factory.hh"
+#include "loggers.hh"
+
+namespace AtsImsIot__TestSystem {
+
+ NaptrPort::NaptrPort(const char *par_port_name): NaptrPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("NaptrPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ NaptrPort::~NaptrPort() {
+ loggers::get_instance().log(">>> NaptrPort::~NaptrPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void NaptrPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("NaptrPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void NaptrPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void NaptrPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void NaptrPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void NaptrPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void NaptrPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void NaptrPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> NaptrPort::user_map: %s", system_port);
+ // Build layer stack
+ params::iterator it = _cfg_params.find(std::string("params"));
+ if (it != _cfg_params.end()) {
+ loggers::get_instance().log("NaptrPort::user_map: %s", it->second.c_str());
+ // Setup parameters
+ params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
+ // Create layer
+ _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
+ if (static_cast(_layer) == nullptr) {
+ loggers::get_instance().error("NaptrPort::user_map: Invalid stack configuration: %s", it->second.c_str());
+ }
+ static_cast(_layer)->add_upper_port(this);
+
+ } else {
+ loggers::get_instance().error("NaptrPort::user_map: No layers defined in configuration file");
+ }
+ } // End of user_map method
+
+ void NaptrPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> NaptrPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void NaptrPort::user_start()
+ {
+ loggers::get_instance().log(">>> NaptrPort::user_start");
+
+ } // End of user_start method
+
+ void NaptrPort::user_stop()
+ {
+ loggers::get_instance().log(">>> NaptrPort::user_stop");
+
+ } // End of user_stop method
+
+ void NaptrPort::receiveMsg (const AtsImsIot__TypesAndValues::NAPTRmessage& p_ind, const params& p_params) {
+ loggers::get_instance().log_msg(">>> NaptrPort::receive_msg: ", p_ind);
+
+ // Sanity check
+ if (!p_ind.is_bound()) {
+ return;
+ }
+
+ incoming_message(p_ind);
+
+ } // End of method receiveMsg
+
+ void NaptrPort::outgoing_send(const AtsImsIot__TypesAndValues::NAPTRmessage& send_par)
+ {
+ loggers::get_instance().log_msg(">>> NaptrPort::outgoing_send: ", send_par);
+
+ float duration;
+ loggers::get_instance().set_start_time(_time_key);
+ params params;
+ static_cast(_layer)->sendMsg(send_par, params);
+ loggers::get_instance().set_stop_time(_time_key, duration);
+ } // End of outgoing_send
+
+}
+
diff --git a/ccsrc/Ports/Naptr/NaptrPort.hh b/ccsrc/Ports/Naptr/NaptrPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..b573737dbab12e0d8f0e0ca593b773091657321e
--- /dev/null
+++ b/ccsrc/Ports/Naptr/NaptrPort.hh
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "AtsImsIot_TestSystem.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace AtsImsIot__TestSystem {
+
+ class NaptrPort : public NaptrPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ NaptrPort(const char *par_port_name);
+ ~NaptrPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const AtsImsIot__TypesAndValues::NAPTRmessage& p_ind, const params& p_params);
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ protected:
+ virtual void outgoing_send(const AtsImsIot__TypesAndValues::NAPTRmessage& send_par);
+ }; // End of class NaptrPort
+
+}
+
diff --git a/ccsrc/Ports/Naptr/module.mk b/ccsrc/Ports/Naptr/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..aeb30dec26ac874b86cbb85363cd1f52017d1ed7
--- /dev/null
+++ b/ccsrc/Ports/Naptr/module.mk
@@ -0,0 +1,3 @@
+sources := NaptrPort.cc
+includes := .
+
diff --git a/ccsrc/Ports/Sgi/SgiPort.cc b/ccsrc/Ports/Sgi/SgiPort.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8d766fd3eacb76da305daadf118057513866d368
--- /dev/null
+++ b/ccsrc/Ports/Sgi/SgiPort.cc
@@ -0,0 +1,73 @@
+#include "SgiPort.hh"
+#include "loggers.hh"
+
+namespace AtsImsIot__TestSystem {
+
+ SgiPort::SgiPort(const char *par_port_name): SgiPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("SgiPort::outgoing_send") {
+ // Nothing to do
+ } // End of constructor
+
+ SgiPort::~SgiPort() {
+ loggers::get_instance().log(">>> SgiPort::~SgiPort");
+
+ if (_layer != nullptr) {
+ delete _layer;
+ }
+ } // End of destructor
+
+ void SgiPort::set_parameter(const char * parameter_name, const char * parameter_value)
+ {
+ loggers::get_instance().log("SgiPort::set_parameter: %s=%s", parameter_name, parameter_value);
+ _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value)));
+ }
+
+ /*void SgiPort::Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error) {}*/
+
+ void SgiPort::Handle_Fd_Event_Error(int /*fd*/)
+ {
+
+ }
+
+ void SgiPort::Handle_Fd_Event_Writable(int /*fd*/)
+ {
+
+ }
+
+ void SgiPort::Handle_Fd_Event_Readable(int /*fd*/)
+ {
+
+ }
+
+ /*void SgiPort::Handle_Timeout(double time_since_last_call) {}*/
+
+ void SgiPort::user_map(const char * system_port)
+ {
+ loggers::get_instance().log(">>> SgiPort::user_map: %s", system_port);
+ } // End of user_map method
+
+ void SgiPort::user_unmap(const char * system_port)
+ {
+ loggers::get_instance().log(">>> SgiPort::user_unmap: %s", system_port);
+
+ // Reset layers
+ if (_layer != nullptr) {
+ delete _layer;
+ _layer = nullptr;
+ }
+ } // End of user_unmap method
+
+ void SgiPort::user_start()
+ {
+ loggers::get_instance().log(">>> SgiPort::user_start");
+
+ } // End of user_start method
+
+ void SgiPort::user_stop()
+ {
+ loggers::get_instance().log(">>> SgiPort::user_stop");
+
+ } // End of user_stop method
+
+}
+
diff --git a/ccsrc/Ports/Sgi/SgiPort.hh b/ccsrc/Ports/Sgi/SgiPort.hh
new file mode 100644
index 0000000000000000000000000000000000000000..740373911762eaef7bcc3b9d512a80b38fa9bca8
--- /dev/null
+++ b/ccsrc/Ports/Sgi/SgiPort.hh
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "AtsImsIot_TestSystem.hh"
+
+#include "layer.hh"
+#include "params.hh"
+
+namespace AtsImsIot__TestSystem {
+
+ class SgiPort : public SgiPort_BASE {
+ params _cfg_params;
+ params _layer_params;
+ layer* _layer;
+ std::string _time_key;
+ public:
+ SgiPort(const char *par_port_name);
+ ~SgiPort();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+ void receiveMsg (const CHARSTRING& p_ind, const params& p_params) {};
+
+ private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+
+ protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ protected:
+ }; // End of class SgiPort
+
+}
+
diff --git a/ccsrc/Ports/Sgi/module.mk b/ccsrc/Ports/Sgi/module.mk
new file mode 100644
index 0000000000000000000000000000000000000000..58a9d0b52c3c4002914bdb6a9a2aac00a1cdcc15
--- /dev/null
+++ b/ccsrc/Ports/Sgi/module.mk
@@ -0,0 +1,3 @@
+sources := SgiPort.cc
+includes := .
+
diff --git a/ccsrc/Protocols/Diameter/avp.cc b/ccsrc/Protocols/Diameter/avp.cc
new file mode 100644
index 0000000000000000000000000000000000000000..68aa8d8e48ad9e5853af13b47f789242c435d44a
--- /dev/null
+++ b/ccsrc/Protocols/Diameter/avp.cc
@@ -0,0 +1,171 @@
+#include
+
+#include "avp.hh"
+
+#include "loggers.hh"
+#include "converter.hh"
+
+avp::avp(const int p_code, const unsigned char p_vendor_specific, const unsigned char p_mandatory, const unsigned char p_protected_, const int p_length, const int p_vendor_id, const int p_encoded_length, const std::vector p_payload) : _code(p_code), _vendor_specific(p_vendor_specific), _mandatory(p_mandatory), _protected_(p_protected_), _length(p_length), _vendor_id(p_vendor_id), _encoded_length(p_encoded_length), _payload(p_payload), _avp_header(LibDiameter__Types__Base__AVPs::AVP__Header(p_code, LibDiameter__Types__Base__AVPs::AVP__Flags( int2bit(p_vendor_specific, 1), int2bit(p_mandatory, 1), int2bit(p_protected_, 1), int2bit(0, 5)), p_length, (p_vendor_specific == 0) ? OPTIONAL(OPTIONAL_OMIT) : OPTIONAL(p_vendor_id))), _enc_avp() {
+ loggers::get_instance().log_msg("avp::avp (1): _avp_header:", _avp_header);
+ loggers::get_instance().log_to_hexa("avp::avp (1): _payload:", _payload.data(), _payload.size());
+} // End of ctor
+
+avp::avp(const int p_code, const unsigned char p_vendor_specific, const unsigned char p_mandatory, const unsigned char p_protected_, const int p_length, const int p_vendor_id, const int p_encoded_length, const std::vector p_payload, const OCTETSTRING& p_enc_avp) : _code(p_code), _vendor_specific(p_vendor_specific), _mandatory(p_mandatory), _protected_(p_protected_), _length(p_length), _vendor_id(p_vendor_id), _encoded_length(p_encoded_length), _payload(p_payload), _avp_header(LibDiameter__Types__Base__AVPs::AVP__Header(p_code, LibDiameter__Types__Base__AVPs::AVP__Flags( int2bit(p_vendor_specific, 1), int2bit(p_mandatory, 1), int2bit(p_protected_, 1), int2bit(0, 5)), p_length, (p_vendor_specific == 0) ? OPTIONAL(OPTIONAL_OMIT) : OPTIONAL(p_vendor_id))), _enc_avp(p_enc_avp) {
+ loggers::get_instance().log_msg("avp::avp (2): _avp_header:", _avp_header);
+ loggers::get_instance().log_to_hexa("avp::avp (2): _payload:", _payload.data(), _payload.size());
+ loggers::get_instance().log_msg("avp::avp (2): _enc_avp:", _enc_avp);
+} // End of ctor
+
+int avp::get_code() const {
+ return _code;
+}
+
+const std::vector& avp::get_payload() const {
+ return _payload;
+}
+
+int avp::decode_session_id(LibDiameter__Types__Base__AVPs::Session__Id__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_session_id: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_session_id: _payload:", _payload.data(), _payload.size());
+
+ p_avp = LibDiameter__Types__Base__AVPs::Session__Id__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), CHARSTRING(converter::get_instance().bytes_to_string(_payload).c_str()));
+ loggers::get_instance().log_msg("avp::decode_session_id: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_auth_session_state(LibDiameter__Types__Base__AVPs::Auth__Session__State__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_auth_session_state: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_auth_session_state: _payload:", _payload.data(), _payload.size());
+
+ // Sanity checks
+ if (_payload.size() != 4) {
+ loggers::get_instance().warning("avp::decode_auth_session_state: Wrong payload length: '%d'", _payload.size());
+ return -1;
+ }
+ p_avp = LibDiameter__Types__Base__AVPs::Auth__Session__State__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), LibDiameter__Types__Base__AVPs::Auth__Session__State__Type(_payload[0] << 24 || _payload[1] << 16 || _payload[2] << 8 || _payload[3]));
+ loggers::get_instance().log_msg("avp::decode_auth_session_state: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_origin_host(LibDiameter__Types__Base__AVPs::Origin__Host__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_origin_host: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_origin_host: _payload:", _payload.data(), _payload.size());
+
+ p_avp = LibDiameter__Types__Base__AVPs::Origin__Host__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), CHARSTRING(converter::get_instance().bytes_to_string(_payload).c_str()));
+ loggers::get_instance().log_msg("avp::decode_origin_host: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_origin_realm(LibDiameter__Types__Base__AVPs::Origin__Realm__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_origin_realm: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_origin_realm: _payload:", _payload.data(), _payload.size());
+
+ p_avp = LibDiameter__Types__Base__AVPs::Origin__Realm__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), CHARSTRING(converter::get_instance().bytes_to_string(_payload).c_str()));
+ loggers::get_instance().log_msg("avp::decode_origin_realm: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_destination_host(LibDiameter__Types__Base__AVPs::Destination__Host__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_destination_host: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_destination_host: _payload:", _payload.data(), _payload.size());
+
+ p_avp = LibDiameter__Types__Base__AVPs::Destination__Host__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), CHARSTRING(converter::get_instance().bytes_to_string(_payload).c_str()));
+ loggers::get_instance().log_msg("avp::decode_destination_host: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_destination_realm(LibDiameter__Types__Base__AVPs::Destination__Realm__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_destination_realm: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_destination_realm: _payload:", _payload.data(), _payload.size());
+
+ p_avp = LibDiameter__Types__Base__AVPs::Destination__Realm__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), CHARSTRING(converter::get_instance().bytes_to_string(_payload).c_str()));
+ loggers::get_instance().log_msg("avp::decode_destination_realm: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_auth_Application_Id(LibDiameter__Types__Base__AVPs::Auth__Application__Id__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_auth_Application_Id: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_auth_Application_Id: _payload:", _payload.data(), _payload.size());
+
+ p_avp = LibDiameter__Types__Base__AVPs::Auth__Application__Id__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), converter::get_instance().bytes_to_int(_payload));
+ loggers::get_instance().log_msg("avp::decode_auth_Application_Id: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_framed_IP_Address(LibDiameter__Types__Base__AVPs::Framed__IP__Address__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_framed_IP_Address: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_framed_IP_Address: _payload:", _payload.data(), _payload.size());
+
+ // Sanity checks
+ if (_payload.size() != 4) {
+ loggers::get_instance().warning("avp::decode_framed_IP_Address: Wrong payload length: '%d'", _payload.size());
+ return -1;
+ }
+ p_avp = LibDiameter__Types__Base__AVPs::Framed__IP__Address__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), OCTETSTRING(_payload.size(), _payload.data()));
+ loggers::get_instance().log_msg("avp::decode_framed_IP_Address: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_media_Component_Description(LibDiameter__Types__Rx__AVPs::Media__Component__Description__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_media_Component_Description: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_media_Component_Description: _payload:", _payload.data(), _payload.size());
+ loggers::get_instance().log_msg("avp::decode_media_Component_Description: _avp_header:", _avp_header);
+
+ p_avp.aVP__Header() = LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header);
+ loggers::get_instance().log_msg("avp::decode_media_Component_Description: p_avp: ", p_avp);
+
+ return 0;
+}
+
+int avp::decode_media_Component_Number(LibDiameter__Types__Base__AVPs::Media__Component__Number__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_media_Component_Number: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_media_Component_Number: _payload:", _payload.data(), _payload.size());
+
+ // Sanity checks
+ if (_payload.size() != 4) {
+ loggers::get_instance().warning("avp::decode_media_Component_Number: Wrong payload length: '%d'", _payload.size());
+ return -1;
+ }
+ p_avp = LibDiameter__Types__Base__AVPs::Media__Component__Number__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), converter::get_instance().bytes_to_int(_payload));
+ loggers::get_instance().log_msg("avp::decode_media_Component_Number: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_media_Type(LibDiameter__Types__Rx__AVPs::Media__Type__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_media_Type: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_media_Type: _payload:", _payload.data(), _payload.size());
+
+ // Sanity checks
+ if (_payload.size() != 4) {
+ loggers::get_instance().warning("avp::decode_media_Type: Wrong payload length: '%d'", _payload.size());
+ return -1;
+ }
+ p_avp = LibDiameter__Types__Rx__AVPs::Media__Type__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), LibDiameter__Types__Rx__AVPs::Media__Type__Type(converter::get_instance().bytes_to_int(_payload)));
+ loggers::get_instance().log_msg("avp::decode_af_Application_Identifier: p_avp:", p_avp);
+
+ return 0;
+}
+
+int avp::decode_af_Application_Identifier(LibDiameter__Types__Rx__AVPs::AF__Application__Identifier__AVP& p_avp) const {
+ loggers::get_instance().log(">>> avp::decode_af_Application_Identifier: '%d'", _code);
+ loggers::get_instance().log_to_hexa("avp::decode_af_Application_Identifier: _payload:", _payload.data(), _payload.size());
+
+ // Sanity checks
+ if (_payload.size() != 4) {
+ loggers::get_instance().warning("avp::decode_af_Application_Identifier: Wrong payload length: '%d'", _payload.size());
+ return -1;
+ }
+ p_avp = LibDiameter__Types__Rx__AVPs::AF__Application__Identifier__AVP(LibDiameter__Types__Base__AVPs::AVP__Header(_avp_header), OCTETSTRING(_payload.size(), _payload.data()));
+ loggers::get_instance().log_msg("avp::decode_af_Application_Identifier: p_avp:", p_avp);
+
+ return 0;
+}
diff --git a/ccsrc/Protocols/Diameter/avp.hh b/ccsrc/Protocols/Diameter/avp.hh
new file mode 100644
index 0000000000000000000000000000000000000000..5526f67cd654bd5b6e6973f63aa285e5ca88bb17
--- /dev/null
+++ b/ccsrc/Protocols/Diameter/avp.hh
@@ -0,0 +1,43 @@
+#pragma once
+
+#include
+#include
+
+
+#include "LibDiameter_TypesAndValues.hh"
+#include "LibDiameter_Types_Rx_AVPs.hh"
+
+class avp {
+ const int _code;
+ const unsigned char _vendor_specific;
+ const unsigned char _mandatory;
+ const unsigned char _protected_;
+ const int _length;
+ const int _vendor_id;
+ const int _encoded_length;
+ const std::vector _payload;
+ const OCTETSTRING _enc_avp;
+ const LibDiameter__Types__Base__AVPs::AVP__Header _avp_header;
+public:
+ avp(const int p_code, const unsigned char p_vendor_specific, const unsigned char p_mandatory, const unsigned char p_protected_, const int p_length, const int p_vendor_id, const int p_encoded_length, const std::vector p_payload);
+ avp(const int p_code, const unsigned char p_vendor_specific, const unsigned char p_mandatory, const unsigned char p_protected_, const int p_length, const int p_vendor_id, const int p_encoded_length, const std::vector p_payload, const OCTETSTRING& p_enc_avp);
+ virtual ~avp() {};
+
+ int get_code() const;
+ const std::vector& get_payload() const;
+
+ int encode_auth_session_state(const LibDiameter__Types__Base__AVPs::Auth__Session__State__AVP& p_avp, std::unique_ptr& p_encoded_avp);
+
+ int decode_session_id(LibDiameter__Types__Base__AVPs::Session__Id__AVP& p_avp) const;
+ int decode_auth_session_state(LibDiameter__Types__Base__AVPs::Auth__Session__State__AVP& p_avp) const;
+ int decode_origin_host(LibDiameter__Types__Base__AVPs::Origin__Host__AVP& p_avp) const;
+ int decode_origin_realm(LibDiameter__Types__Base__AVPs::Origin__Realm__AVP& p_avp) const;
+ int decode_destination_host(LibDiameter__Types__Base__AVPs::Destination__Host__AVP& p_avp) const;
+ int decode_destination_realm(LibDiameter__Types__Base__AVPs::Destination__Realm__AVP& p_avp) const;
+ int decode_auth_Application_Id(LibDiameter__Types__Base__AVPs::Auth__Application__Id__AVP& p_avp) const;
+ int decode_framed_IP_Address(LibDiameter__Types__Base__AVPs::Framed__IP__Address__AVP& p_avp) const;
+ int decode_media_Component_Description(LibDiameter__Types__Rx__AVPs::Media__Component__Description__AVP& p_avp) const;
+ int decode_media_Component_Number(LibDiameter__Types__Base__AVPs::Media__Component__Number__AVP& p_avp) const;
+ int decode_media_Type(LibDiameter__Types__Rx__AVPs::Media__Type__AVP& p_avp) const;
+ int decode_af_Application_Identifier(LibDiameter__Types__Rx__AVPs::AF__Application__Identifier__AVP& p_avp) const;
+}; // End of class avp
\ No newline at end of file
diff --git a/ccsrc/Protocols/Diameter/diameter_aar_codec.cc b/ccsrc/Protocols/Diameter/diameter_aar_codec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..65b22d73e93c1b776323ddecf41c30a8b3b05741
--- /dev/null
+++ b/ccsrc/Protocols/Diameter/diameter_aar_codec.cc
@@ -0,0 +1,183 @@
+#include
+
+#include "avp.hh"
+
+#include "diameter_aar_codec.hh"
+
+#include "loggers.hh"
+#include "converter.hh"
+
+template class OPTIONAL;
+class TTCN_EncDec;
+
+int diameter_aar_codec::encode(const LibDiameter__TypesAndValues::AAR__MSG& p_aar_msg, OCTETSTRING& p_data) {
+ loggers::get_instance().log_msg(">>> diameter_aar_codec::encode", (const Base_Type &)p_aar_msg);
+
+ TTCN_EncDec::clear_error();
+ TTCN_Buffer encoding_buffer;
+
+ if (_codec.encode_header(p_aar_msg.header(), encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::encode: Failed to encode AAR header");
+ return -1;
+ }
+
+ if (encode_avps(p_aar_msg, encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::encode: Failed to encode AAR AVPs");
+ return -1;
+ }
+
+ p_data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data());
+ // Update length at offset #1 on 3 bytes
+
+ return 0;
+}
+
+int diameter_aar_codec::encode_avps(const LibDiameter__TypesAndValues::AAR__MSG& p_aar_msg, TTCN_Buffer p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_aar_codec::encode_avps: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ // SessionId
+ if (_codec.encode_session_id(p_aar_msg.session__Id(), p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::encode_avps: Failed to encode session__Id__AVP");
+ return -1;
+ }
+
+ // Mandatory AVPs
+ if (_codec.encode_origin_host(p_aar_msg.aAR__Body().origin__Host(), p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::encode_avps: Failed to encode Origin__Host__AVP");
+ return -1;
+ }
+ if (_codec.encode_origin_realm(p_aar_msg.aAR__Body().origin__Realm(), p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::encode_avps: Failed to encode Origin__Realm__AVP");
+ return -1;
+ }
+ if (_codec.encode_auth_Application_Id(p_aar_msg.aAR__Body().auth__Application__Id(), p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::encode_avps: Failed to encode Auth__Application__Id__AVP");
+ return -1;
+ }
+
+ // Optional AVPs
+ loggers::get_instance().log_msg("diameter_aar_codec::encode_avps: destination__Host: ", p_aar_msg.aAR__Body().destination__Host());
+ if (p_aar_msg.aAR__Body().destination__Host().is_present()) {
+ const LibDiameter__Types__Base__AVPs::Destination__Host__AVP& avp = static_cast(*p_aar_msg.aAR__Body().destination__Host().get_opt_value());
+ if (_codec.encode_destination_host(avp, p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::encode_avps: Failed to encode Destination__Host__AVP");
+ }
+ }
+ loggers::get_instance().log_msg("diameter_aar_codec::encode_avps: framed__IP__Address: ", p_aar_msg.aAR__Body().framed__IP__Address());
+ if (p_aar_msg.aAR__Body().framed__IP__Address().is_present()) {
+ const LibDiameter__Types__Base__AVPs::Framed__IP__Address__AVP& avp = static_cast(*p_aar_msg.aAR__Body().framed__IP__Address().get_opt_value());
+ if (_codec.encode_framed_IP_Address(avp, p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::encode_avps: Framed__IP__Address is missing");
+ }
+ }
+ //TODO Continue
+
+ loggers::get_instance().log_msg("<<< diameter_aar_codec::encode_avps: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_aar_codec::decode(const OCTETSTRING& p_data, LibDiameter__TypesAndValues::AAR__MSG& p_aar_msg, params* p_params) {
+ loggers::get_instance().log_msg(">>> diameter_aar_codec::decode: ", (const Base_Type &)p_data);
+
+ TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
+ TTCN_EncDec::clear_error();
+ TTCN_Buffer decoding_buffer(p_data);
+
+ params _params;
+ _params.insert(std::make_pair("Request", "1"));
+
+ if (_codec.decode_header(decoding_buffer, p_aar_msg.header(), static_cast(_params)) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::decode: Failed to decode AAR message header");
+ return -1;
+ }
+
+ if (_codec.decode_avps(decoding_buffer, p_aar_msg.header(), static_cast(_params)) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::decode: Failed to decode AAR AVPs");
+ return -1;
+ }
+
+ // Mandatory AVPs
+ if (decode_origin_host(p_aar_msg.aAR__Body().origin__Host()) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::decode: Missing Origin__Host__AVP");
+ return -1;
+ }
+ if (decode_origin_realm(p_aar_msg.aAR__Body().origin__Realm()) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::decode: Missing Origin__Realm__AVP");
+ return -1;
+ }
+ if (decode_destination_realm(p_aar_msg.aAR__Body().destination__Realm()) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::decode: Missing Destination__Realm__AVP");
+ return -1;
+ }
+ if (decode_session_id(p_aar_msg.session__Id()) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::decode: Missing Destination__Realm__AVP");
+ return -1;
+ }
+
+ // Optinal AVPs
+ if (decode_destination_host(p_aar_msg.aAR__Body().destination__Host()) == -1) {
+ p_aar_msg.aAR__Body().destination__Host().set_to_omit();
+ }
+ if (decode_auth_Application_Id(p_aar_msg.aAR__Body().auth__Application__Id()) == -1) {
+ p_aar_msg.aAR__Body().auth__Application__Id().set_to_omit();
+ }
+ if (decode_framed_IP_Address(p_aar_msg.aAR__Body().framed__IP__Address()) == -1) {
+ p_aar_msg.aAR__Body().framed__IP__Address().set_to_omit();
+ }
+ if (decode_media_Component_Description(p_aar_msg.aAR__Body().media__Component__Description()) == -1) {
+ p_aar_msg.aAR__Body().media__Component__Description().set_to_omit();
+ }
+ if (decode_af_Application_Identifier(p_aar_msg.aAR__Body().af__Application__Id()) == -1) {
+ p_aar_msg.aAR__Body().af__Application__Id().set_to_omit();
+ }
+
+ p_aar_msg.aAR__Body().service__Info__Status().set_to_omit();
+ p_aar_msg.aAR__Body().af__Charging__Identifier().set_to_omit();
+ p_aar_msg.aAR__Body().sip__Forking__Indication().set_to_omit();
+ p_aar_msg.aAR__Body().specific__Action().set_to_omit();
+ p_aar_msg.aAR__Body().subscription__Id().set_to_omit();
+ p_aar_msg.aAR__Body().supported__Features().set_to_omit();
+ p_aar_msg.aAR__Body().reservation__Priority().set_to_omit();
+ p_aar_msg.aAR__Body().framed__IPv6__Address().set_to_omit();
+ p_aar_msg.aAR__Body().called__Station__Id().set_to_omit();
+ p_aar_msg.aAR__Body().service__URN().set_to_omit();
+ p_aar_msg.aAR__Body().sponsored__Connectivity__Data().set_to_omit();
+ p_aar_msg.aAR__Body().mps__Identifier().set_to_omit();
+ p_aar_msg.aAR__Body().gcs__Identifier().set_to_omit();
+ p_aar_msg.aAR__Body().mcptt__Identifier().set_to_omit();
+ p_aar_msg.aAR__Body().mCVideo__Identifier().set_to_omit();
+ p_aar_msg.aAR__Body().iMS__Content__Identifier().set_to_omit();
+ p_aar_msg.aAR__Body().iMS__Content__Type().set_to_omit();
+ p_aar_msg.aAR__Body().rx__Request__Type().set_to_omit();
+ p_aar_msg.aAR__Body().required__Access__Info().set_to_omit();
+ p_aar_msg.aAR__Body().aF__Requested__Data().set_to_omit();
+ p_aar_msg.aAR__Body().pre__emption__Control__Info().set_to_omit();
+ p_aar_msg.aAR__Body().user__Name().set_to_omit();
+ p_aar_msg.aAR__Body().origin__State__Id().set_to_omit();
+ p_aar_msg.aAR__Body().proxy__Info().set_to_omit();
+ p_aar_msg.aAR__Body().route__Record().set_to_omit();
+ p_aar_msg.aAR__Body().aVP__Type().set_to_omit();
+
+ return 0;
+}
+
+int diameter_aar_codec::decode_media_Component_Description(LibDiameter__TypesAndValues::AAR__Body__AVP_media__Component__Description& p_avp) {
+ loggers::get_instance().log(">>> decode_media_Component_Description");
+
+ const std::unique_ptr& avp_ptr = _codec.get_avp(_codec.AVP_Media_Component_Description_AVP);
+ if (avp_ptr.get() == nullptr) {
+ loggers::get_instance().log("diameter_aar_codec::decode_media_Component_Description: AVP not found");
+ return -1;
+ }
+
+ LibDiameter__Types__Rx__AVPs::Media__Component__Description__AVP avp;
+ if (_codec.decode_media_Component_Description(avp) == -1) {
+ loggers::get_instance().warning("diameter_aar_codec::decode_media_Component_Description: Failed to decode Media__Component__Description__AVP");
+ return -1;
+ }
+
+ p_avp.set_value(&avp);
+
+ loggers::get_instance().log_msg("<<< decode_media_Component_Description: ", (const Base_Type &)p_avp);
+ return 0;
+}
diff --git a/ccsrc/Protocols/Diameter/diameter_aar_codec.hh b/ccsrc/Protocols/Diameter/diameter_aar_codec.hh
new file mode 100644
index 0000000000000000000000000000000000000000..8c037f73a2ac75348755ae2d512d450e2e210398
--- /dev/null
+++ b/ccsrc/Protocols/Diameter/diameter_aar_codec.hh
@@ -0,0 +1,52 @@
+#pragma once
+
+#include
+
+#include "codec_gen.hh"
+#include "params.hh"
+
+#include "avp.hh"
+#include "diameter_codec.hh"
+
+class Base_Type;
+class TTCN_Typedescriptor_t;
+class TTCN_Buffer;
+
+namespace LibDiameter__TypesAndValues {
+ class AAR__MSG; //! Forward declaration of TITAN class
+}
+
+namespace LibDiameter__Types__Rx__AVPs {
+ class Media__Component__Description__AVP; //! Forward declaration of TITAN class
+}
+
+class diameter_aar_codec: public codec_gen <
+ LibDiameter__TypesAndValues::AAR__MSG,
+ LibDiameter__TypesAndValues::AAR__MSG>
+{
+ std::vector avps;
+ diameter_codec _codec;
+
+public:
+ diameter_aar_codec() : codec_gen(), avps(), _codec() { };
+ virtual ~diameter_aar_codec() { };
+
+ virtual int encode (const LibDiameter__TypesAndValues::AAR__MSG& p_aar_msg, OCTETSTRING& p_data);
+ virtual int decode (const OCTETSTRING& p_data, LibDiameter__TypesAndValues::AAR__MSG& p_aar_msg, params* p_params = NULL);
+
+private:
+ int encode_avps(const LibDiameter__TypesAndValues::AAR__MSG& p_aar_msg, TTCN_Buffer p_encoding_buffer);
+
+ inline int decode_session_id(LibDiameter__Types__Base__AVPs::Session__Id__AVP& p_avp) { return _codec.decode_session_id(p_avp); };
+ inline int decode_auth_session_state(LibDiameter__Types__Base__AVPs::Auth__Session__State__AVP& p_avp) { return _codec.decode_auth_session_state(p_avp); };
+ inline int decode_origin_host(LibDiameter__Types__Base__AVPs::Origin__Host__AVP& p_avp) { return _codec.decode_origin_host(p_avp); };
+ inline int decode_destination_host(LibDiameter__Types__Base__AVPs::Destination__Host__AVP& p_avp) { return _codec.decode_destination_host(p_avp); };
+ inline int decode_origin_realm(LibDiameter__Types__Base__AVPs::Origin__Realm__AVP& p_avp) { return _codec.decode_origin_realm(p_avp); };
+ inline int decode_destination_realm(LibDiameter__Types__Base__AVPs::Destination__Realm__AVP& p_avp) { return _codec.decode_destination_realm(p_avp); };
+ inline int decode_auth_Application_Id(LibDiameter__Types__Base__AVPs::Auth__Application__Id__AVP& p_avp) { return _codec.decode_auth_Application_Id(p_avp); };
+ inline int decode_framed_IP_Address(LibDiameter__Types__Base__AVPs::Framed__IP__Address__AVP& p_avp) { return _codec.decode_framed_IP_Address(p_avp); };
+ inline int decode_af_Application_Identifier(LibDiameter__Types__Rx__AVPs::AF__Application__Identifier__AVP& p_avp) { return _codec.decode_af_Application_Identifier(p_avp); };
+
+ int decode_media_Component_Description(LibDiameter__TypesAndValues::AAR__Body__AVP_media__Component__Description& p_avp);
+
+}; // End of class diameter_aar_codec
diff --git a/ccsrc/Protocols/Diameter/diameter_codec.cc b/ccsrc/Protocols/Diameter/diameter_codec.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e18114b137a6947f403be30c27e10e93a62ae977
--- /dev/null
+++ b/ccsrc/Protocols/Diameter/diameter_codec.cc
@@ -0,0 +1,913 @@
+#include
+
+#include "LibDiameter_TypesAndValues.hh"
+
+#include "diameter_codec.hh"
+
+#include "loggers.hh"
+#include "converter.hh"
+
+template class OPTIONAL;
+class TTCN_Buffer;
+class TTCN_EncDec;
+
+diameter_codec::~diameter_codec() {
+ loggers::get_instance().log(">>> diameter_codec::~diameter_codec");
+ if (_avps.size() != 0) {
+ _avps.clear();
+ }
+}
+
+int diameter_codec::encode_header(const LibDiameter__TypesAndValues::DiameterHeader& p_header, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_header: ", (const Base_Type &)p_header);
+
+ p_encoding_buffer.put_c(p_header.version());
+
+ p_encoding_buffer.put_c(static_cast((p_header.msglen() >> 16) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((p_header.msglen() >> 8) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((p_header.msglen()) & 0xFF));
+
+ unsigned char cmdflags = 0x00;
+ BITSTRING bit_set = int2bit(1, 1);
+ if (p_header.cmdflags().r__bit() == bit_set) {
+ cmdflags |= 0x80;
+ }
+ if (p_header.cmdflags().p__bit() == bit_set) {
+ cmdflags |= 0x40;
+ }
+ if (p_header.cmdflags().e__bit() == bit_set) {
+ cmdflags |= 0x20;
+ }
+ if (p_header.cmdflags().t__bit() == bit_set) {
+ cmdflags |= 0x10;
+ }
+ p_encoding_buffer.put_c(cmdflags);
+
+ int cmdcode = _command_codes[p_header.cmdcode()];
+ p_encoding_buffer.put_c(static_cast((cmdcode >> 16) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((cmdcode >> 8) & 0xFF));
+ p_encoding_buffer.put_c(static_cast(cmdcode & 0xFF));
+
+ p_encoding_buffer.put_c(static_cast((p_header.applid() >> 24) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((p_header.applid() >> 16) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((p_header.applid() >> 8) & 0xFF));
+ p_encoding_buffer.put_c(static_cast(p_header.applid() & 0xFF));
+
+ p_encoding_buffer.put_c(static_cast((p_header.hopid() >> 24) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((p_header.hopid() >> 16) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((p_header.hopid() >> 8) & 0xFF));
+ p_encoding_buffer.put_c(static_cast(p_header.hopid() & 0xFF));
+
+ p_encoding_buffer.put_c(static_cast((p_header.endid() >> 24) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((p_header.endid() >> 16) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((p_header.endid() >> 8) & 0xFF));
+ p_encoding_buffer.put_c(static_cast(p_header.endid() & 0xFF));
+
+ _avps.clear(); // unique_ptr class manages deletion of resources
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_header: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+} // End of method encode_header
+
+int diameter_codec::encode_session_id(const LibDiameter__Types__Base__AVPs::Session__Id__AVP& p_avp, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_session_id: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ // TODO Group
+
+ // Encode AVP header
+ int padding = 0;
+ if (encode_avp_header(p_avp.aVP__Header(), &padding, p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_codec::encode_session_id: Failed to encode AVP header");
+ return -1;
+ }
+
+ const OCTETSTRING& os = unichar2oct(p_avp.aVP__Data());
+ p_encoding_buffer.put_string(os);
+
+ _avps.insert(
+ std::make_pair >(
+ p_avp.aVP__Header().aVP__Code(),
+ std::unique_ptr(
+ new avp(
+ p_avp.aVP__Header().aVP__Code(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().m__bit()[0].get_bit()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().p__bit()[0].get_bit()) ? 0x01 : 0x00,
+ p_avp.aVP__Header().aVP__len(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? static_cast(static_cast(*p_avp.aVP__Header().aVP__vid().get_opt_value())) : 0,
+ p_avp.aVP__Header().aVP__len(),
+ std::vector(static_cast(os), static_cast(os) + os.lengthof()),
+ static_cast(OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()))
+ ))));
+
+ if (padding != 0) {
+ OCTETSTRING os = int2oct(0, padding);
+ p_encoding_buffer.put_string(os);
+ }
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_session_id: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_codec::encode_origin_host(const LibDiameter__Types__Base__AVPs::Origin__Host__AVP& p_avp, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_origin_host: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ // TODO Group
+
+ // Encode AVP header
+ int padding = 0;
+ if (encode_avp_header(p_avp.aVP__Header(), &padding, p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_codec::encode_origin_host: Failed to encode AVP header");
+ return -1;
+ }
+
+ const OCTETSTRING& os = char2oct(p_avp.aVP__Data());
+ p_encoding_buffer.put_string(os);
+
+ _avps.insert(
+ std::make_pair >(
+ p_avp.aVP__Header().aVP__Code(),
+ std::unique_ptr(
+ new avp(
+ p_avp.aVP__Header().aVP__Code(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().m__bit()[0].get_bit()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().p__bit()[0].get_bit()) ? 0x01 : 0x00,
+ p_avp.aVP__Header().aVP__len(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? static_cast(static_cast(*p_avp.aVP__Header().aVP__vid().get_opt_value())) : 0,
+ p_avp.aVP__Header().aVP__len(),
+ std::vector(static_cast(os), static_cast(os) + os.lengthof()),
+ static_cast(OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()))
+ ))));
+
+ if (padding != 0) {
+ OCTETSTRING os = int2oct(0, padding);
+ p_encoding_buffer.put_string(os);
+ }
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_origin_host: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_codec::encode_origin_realm(const LibDiameter__Types__Base__AVPs::Origin__Realm__AVP& p_avp, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_origin_realm: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ // TODO Group
+
+ // Encode AVP header
+ int padding = 0;
+ if (encode_avp_header(p_avp.aVP__Header(), &padding, p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_codec::encode_origin_realm: Failed to encode AVP header");
+ return -1;
+ }
+
+ const OCTETSTRING& os = char2oct(p_avp.aVP__Data());
+ p_encoding_buffer.put_string(os);
+
+ _avps.insert(
+ std::make_pair >(
+ p_avp.aVP__Header().aVP__Code(),
+ std::unique_ptr(
+ new avp(
+ p_avp.aVP__Header().aVP__Code(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().m__bit()[0].get_bit()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().p__bit()[0].get_bit()) ? 0x01 : 0x00,
+ p_avp.aVP__Header().aVP__len(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? static_cast(static_cast(*p_avp.aVP__Header().aVP__vid().get_opt_value())) : 0,
+ p_avp.aVP__Header().aVP__len(),
+ std::vector(static_cast(os), static_cast(os) + os.lengthof()),
+ static_cast(OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()))
+ ))));
+
+ if (padding != 0) {
+ OCTETSTRING os = int2oct(0, padding);
+ p_encoding_buffer.put_string(os);
+ }
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_origin_realm: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_codec::encode_destination_host(const LibDiameter__Types__Base__AVPs::Destination__Host__AVP& p_avp, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_destination_host: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ // TODO Group
+
+ // Encode AVP header
+ int padding = 0;
+ if (encode_avp_header(p_avp.aVP__Header(), &padding, p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_codec::encode_origin_host: Failed to encode AVP header");
+ return -1;
+ }
+
+ const OCTETSTRING& os = char2oct(p_avp.aVP__Data());
+ p_encoding_buffer.put_string(os);
+
+ _avps.insert(
+ std::make_pair >(
+ p_avp.aVP__Header().aVP__Code(),
+ std::unique_ptr(
+ new avp(
+ p_avp.aVP__Header().aVP__Code(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().m__bit()[0].get_bit()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().p__bit()[0].get_bit()) ? 0x01 : 0x00,
+ p_avp.aVP__Header().aVP__len(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? static_cast(static_cast(*p_avp.aVP__Header().aVP__vid().get_opt_value())) : 0,
+ p_avp.aVP__Header().aVP__len(),
+ std::vector(static_cast(os), static_cast(os) + os.lengthof()),
+ static_cast(OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()))
+ ))));
+
+ if (padding != 0) {
+ OCTETSTRING os = int2oct(0, padding);
+ p_encoding_buffer.put_string(os);
+ }
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_destination_host: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_codec::encode_auth_session_state(const LibDiameter__Types__Base__AVPs::Auth__Session__State__AVP& p_avp, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_auth_session_state: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ // TODO Group
+
+ // Encode AVP header
+ int padding = 0;
+ if (encode_avp_header(p_avp.aVP__Header(), &padding, p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_codec::encode_auth_session_state: Failed to encode AVP header");
+ return -1;
+ }
+
+ int conv = p_avp.aVP__Data().as_int();
+ std::vector v;
+ unsigned char c = static_cast((conv >> 24) & 0xFF);
+ v.push_back(c);
+ p_encoding_buffer.put_c(c);
+ c = static_cast((conv >> 16) & 0xFF);
+ p_encoding_buffer.put_c(c);
+ v.push_back(c);
+ c = static_cast((conv >> 8) & 0xFF);
+ p_encoding_buffer.put_c(c);
+ v.push_back(c);
+ c = static_cast(conv & 0xFF);
+ p_encoding_buffer.put_c(c);
+ v.push_back(c);
+
+ _avps.insert(
+ std::make_pair >(
+ p_avp.aVP__Header().aVP__Code(),
+ std::unique_ptr(
+ new avp(
+ p_avp.aVP__Header().aVP__Code(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().m__bit()[0].get_bit()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().p__bit()[0].get_bit()) ? 0x01 : 0x00,
+ p_avp.aVP__Header().aVP__len(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? static_cast(static_cast(*p_avp.aVP__Header().aVP__vid().get_opt_value())) : 0,
+ p_avp.aVP__Header().aVP__len(),
+ v,
+ static_cast(OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()))
+ ))));
+
+ if (padding != 0) {
+ OCTETSTRING os = int2oct(0, padding);
+ p_encoding_buffer.put_string(os);
+ }
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_auth_session_state: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_codec::encode_auth_Application_Id(const LibDiameter__Types__Base__AVPs::Auth__Application__Id__AVP& p_avp, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_auth_Application_Id: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ // TODO Group
+
+ // Encode AVP header
+ int padding = 0;
+ if (encode_avp_header(p_avp.aVP__Header(), &padding, p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_codec::encode_auth_Application_Id: Failed to encode AVP header");
+ return -1;
+ }
+
+ int conv = p_avp.aVP__Data();
+ std::vector v;
+ unsigned char c = static_cast((conv >> 24) & 0xFF);
+ v.push_back(c);
+ p_encoding_buffer.put_c(c);
+ c = static_cast((conv >> 16) & 0xFF);
+ p_encoding_buffer.put_c(c);
+ v.push_back(c);
+ c = static_cast((conv >> 8) & 0xFF);
+ p_encoding_buffer.put_c(c);
+ v.push_back(c);
+ c = static_cast(conv & 0xFF);
+ p_encoding_buffer.put_c(c);
+ v.push_back(c);
+
+ _avps.insert(
+ std::make_pair >(
+ p_avp.aVP__Header().aVP__Code(),
+ std::unique_ptr(
+ new avp(
+ p_avp.aVP__Header().aVP__Code(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().m__bit()[0].get_bit()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().p__bit()[0].get_bit()) ? 0x01 : 0x00,
+ p_avp.aVP__Header().aVP__len(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? static_cast(static_cast(*p_avp.aVP__Header().aVP__vid().get_opt_value())) : 0,
+ p_avp.aVP__Header().aVP__len(),
+ v,
+ static_cast(OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()))
+ ))));
+
+ if (padding != 0) {
+ OCTETSTRING os = int2oct(0, padding);
+ p_encoding_buffer.put_string(os);
+ }
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_auth_Application_Id: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_codec::encode_framed_IP_Address(const LibDiameter__Types__Base__AVPs::Framed__IP__Address__AVP& p_avp, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_framed_IP_Address: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ // TODO Group
+
+ // Encode AVP header
+ int padding = 0;
+ if (encode_avp_header(p_avp.aVP__Header(), &padding, p_encoding_buffer) == -1) {
+ loggers::get_instance().warning("diameter_codec::encode_framed_IP_Address: Failed to encode AVP header");
+ return -1;
+ }
+
+ _avps.insert(
+ std::make_pair >(
+ p_avp.aVP__Header().aVP__Code(),
+ std::unique_ptr(
+ new avp(
+ p_avp.aVP__Header().aVP__Code(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().m__bit()[0].get_bit()) ? 0x01 : 0x00,
+ (p_avp.aVP__Header().aVP__flags().p__bit()[0].get_bit()) ? 0x01 : 0x00,
+ p_avp.aVP__Header().aVP__len(),
+ (p_avp.aVP__Header().aVP__vid().is_present()) ? static_cast(static_cast(*p_avp.aVP__Header().aVP__vid().get_opt_value())) : 0,
+ p_avp.aVP__Header().aVP__len(),
+ std::vector(static_cast(p_avp.aVP__Data()), static_cast(p_avp.aVP__Data()) + p_avp.aVP__Data().lengthof()),
+ static_cast(OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()))
+ ))));
+
+ if (padding != 0) {
+ OCTETSTRING os = int2oct(0, padding);
+ p_encoding_buffer.put_string(os);
+ }
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_framed_IP_Address: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_codec::encode_media_Component_Description(const LibDiameter__Types__Rx__AVPs::Media__Component__Description__AVP& p_avp, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_media_Component_Description: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ // TODO Group
+
+ // Encode AVP header
+ int padding = 0;
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_media_Component_Description: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_codec::encode_avp_header(const LibDiameter__Types__Base__AVPs::AVP__Header& p_header, int* p_padding, TTCN_Buffer& p_encoding_buffer) {
+ loggers::get_instance().log_msg(">>> diameter_codec::encode_avp_header: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+
+ int total_length = 4 + 4 + p_header.aVP__len();
+ loggers::get_instance().log("diameter_codec::encode_avp_header: total_length: '%d'", total_length);
+
+ if (p_header.aVP__vid().is_present()) {
+ total_length += 4;
+ }
+ int send_length = total_length;
+ if ((total_length % 4) != 0) {
+ total_length = (total_length / 4 + 1) * 4;
+ *p_padding = total_length - send_length;
+ }
+ loggers::get_instance().log("diameter_codec::encode_avp_header: send_length: '%d'", send_length);
+ loggers::get_instance().log("diameter_codec::encode_avp_header: total_length after padding: '%d'", total_length);
+ loggers::get_instance().log("diameter_codec::encode_avp_header: *p_padding: '%d'", *p_padding);
+
+ int conv = p_header.aVP__Code();
+ p_encoding_buffer.put_c(static_cast((conv >> 24) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((conv >> 16) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((conv >> 8) & 0xFF));
+ p_encoding_buffer.put_c(static_cast(conv & 0xFF));
+
+ unsigned char flags = 0x00;
+ if (p_header.aVP__vid().is_present()) {
+ flags |= 0x80;
+ }
+ if (p_header.aVP__flags().m__bit()[0].get_bit()) {
+ flags |= 0x40;
+
+ }
+ if (p_header.aVP__flags().p__bit()[0].get_bit()) {
+ flags |= 0x20;
+
+ }
+ p_encoding_buffer.put_c(flags);
+
+ conv = send_length;
+ p_encoding_buffer.put_c(static_cast((send_length >> 16) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((send_length >> 8) & 0xFF));
+ p_encoding_buffer.put_c(static_cast(send_length & 0xFF));
+
+ if (p_header.aVP__vid().is_present()) {
+ conv = static_cast(*p_header.aVP__vid().get_opt_value());
+ p_encoding_buffer.put_c(static_cast((conv >> 24) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((conv >> 16) & 0xFF));
+ p_encoding_buffer.put_c(static_cast((conv >> 8) & 0xFF));
+ p_encoding_buffer.put_c(static_cast(conv & 0xFF));
+ }
+
+ loggers::get_instance().log_msg("<<< diameter_codec::encode_avp_header: ", OCTETSTRING(p_encoding_buffer.get_len(), p_encoding_buffer.get_data()));
+ return 0;
+}
+
+int diameter_codec::decode_header(TTCN_Buffer& p_decoding_buffer, LibDiameter__TypesAndValues::DiameterHeader& p_header, const params& p_params) {
+ loggers::get_instance().log(">>> diameter_codec::decode_header: '%p'", _start);
+
+ // Sanity check
+ if (p_decoding_buffer.get_len() < 20) { // DiameterHeader size
+ loggers::get_instance().warning("diameter_codec::decode: Wrong packet length for daimeter message");
+ return -1;
+ }
+
+ _start = static_cast(p_decoding_buffer.get_data());
+ _avps.clear(); // unique_ptr class manages deletion of resources
+
+ p_header.version() = static_cast(*_start++ & 0xFF);
+ p_header.msglen() = static_cast(static_cast(*_start++ & 0xFF) << 16 | static_cast(*_start++ & 0xFF) << 8 | static_cast(*_start++ & 0xFF));
+ // Resize the docoding buffer
+ if ((int)p_header.msglen() > p_decoding_buffer.get_len()) {
+ loggers::get_instance().warning("diameter_codec::decode: Resize docoding buffer: '%d' to '%d'", p_header.msglen(), p_decoding_buffer.get_len());
+ p_header.msglen() = p_decoding_buffer.get_len();
+ }
+ _end = static_cast(p_decoding_buffer.get_data()) + p_header.msglen();
+ loggers::get_instance().log("diameter_codec::decode: _end: '%p' - offset: '%d'", _end, static_cast(_end - _start));
+ loggers::get_instance().log_to_hexa("diameter_codec::decode: diameter message:", _start, static_cast(_end - _start));
+
+ p_header.cmdflags().r__bit() = int2bit(static_cast(static_cast(*_start & 0x80) != 0), 1);
+ p_header.cmdflags().p__bit() = int2bit(static_cast(static_cast(*_start & 0x40) != 0), 1);
+ p_header.cmdflags().e__bit() = int2bit(static_cast(static_cast(*_start & 0x20) != 0), 1);
+ p_header.cmdflags().t__bit() = int2bit(static_cast(static_cast(*_start & 0x10) != 0), 1);
+ p_header.cmdflags().reserved__bits() = int2bit(static_cast(*_start++ & 0x0F), 4);
+
+ params::const_iterator it = p_params.find(std::string("Request"));
+ boolean is_request = true;
+ if (it != p_params.cend()) {
+ is_request = it->second.compare("1") == 0;
+ }
+ p_header.cmdcode() = LibDiameter__TypesAndValues::Command__Code::str_to_enum(
+ command_code_2_enumerated(
+ static_cast(static_cast(*_start++ & 0xFF) << 16 | static_cast(*_start++ & 0xFF) << 8 | static_cast(*_start++ & 0xFF)),
+ static_cast(is_request)
+ ).c_str()
+ );
+
+ p_header.applid() = static_cast(static_cast(*_start++ & 0xFF) << 24 | static_cast(*_start++ & 0xFF) << 16 | static_cast(*_start++ & 0xFF) << 8 | static_cast(*_start++ & 0xFF));
+
+ p_header.hopid() = static_cast(static_cast(*_start++ & 0xFF) << 24 | static_cast(*_start++ & 0xFF) << 16 | static_cast(*_start++ & 0xFF) << 8 | static_cast(*_start++ & 0xFF));
+
+ p_header.endid() = static_cast