Commit c56308e2 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Merge branch 'v2.1.1-dev'

parents 3ef2a297 6aad2ffd
-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 += $(1)/$$(S)))
$$(foreach I, $$(includes), $$(eval all_includes += $(1)/$$(I)))
$$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(M), $(1)/$$(M)))))
endef
all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src $(TOPDIR)/ccsrc/Framework
defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL
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
$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS)))
outdir := $(TOPDIR)/build/$(ATS)
bindir := $(TOPDIR)/bin
sources := $(sort $(all_sources))
includes := $(outdir) $(outdir)/.. $(all_includes) $(NPCAP_INCLUDE)
ifeq (Windows_NT,$(OS))
EXE=.exe
endif
ttcn_sources := $(filter %.ttcn , $(sources))
ttcn3_sources := $(filter %.ttcn3, $(sources))
tt_sources := $(ttcn_sources) $(ttcn3_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_sources := $(gen_ttcn_sources) $(gen_ttcn3_sources)
gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_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) $(bindir):
mkdir -p $@
$(bindir)/$(ATS)$(EXE): $(gen_objects) $(cc_objects)
g++ -g -O0 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(libs)
$(gen_objects) :%.o :%.cc
g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $<
$(cc_objects) : $(outdir)/%.o : %.cc
mkdir -p $(dir $@)
g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $<
#$(gen_sources):
# $(TTCN3_DIR)/bin/compiler -n -e -L -R -U none -o $(outdir) $(tt_sources)
$(gen_sources): $(outdir)/.generate
$(outdir)/.generate: Makefile $(tt_sources)
$(TTCN3_DIR)/bin/compiler -b -d -e -f -g -l -L -M -n -O -r -R -U none -x -X -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)))
sources := LibItsHttp_Encdec.cc
sources := LocationAPI
......@@ -11,6 +11,7 @@
#pragma once
#include <vector>
#include <string>
#include <map>
/*!
......@@ -29,11 +30,54 @@ public: //! \publicsection
static const std::string& mac_dst; //! Destination MAC address parameter name
static const std::string& mac_bc; //! Broadcast MAC address parameter name
static const std::string& eth_type; //! Ethernet type parameter name
static const std::string& beaconing; //! Beaconing mode parameter name
static const std::string& timestamp; //! Packet reception timestamp
static const std::string& station_type;
static const std::string& country;
static const std::string& type_of_address;
static const std::string& ssp; //! SSP parameter name
static const std::string& its_aid; //! ITS-AID parameter name
static const std::string& gn_payload; //! GeoNetworking Payload parameter name
static const std::string& gn_next_header; //! GeoNetworking NextHeader parameter name
static const std::string& gn_header_type; //! GeoNetworking HeaderType parameter name
static const std::string& gn_header_sub_type; //! GeoNetworking HeaderSubType parameter name
static const std::string& gn_lifetime; //! GeoNetworking Lifetime parameter name
static const std::string& gn_traffic_class; //! GeoNetworking Traffic class parameter name
static const std::string& btp_type; //! BTP Type parameter name
static const std::string& btp_payload; //! BTP Payload parameter name
static const std::string& btp_destination_port; //! BTP DestinationPort parameter name
static const std::string& btp_info; //! BTP Info parameter name
static const std::string& nic; //! Network Interface Card parameter name
static const std::string& ll_address; //! Test system GeoNetworking LL-Address parameter name
static const std::string& latitude; //! Test system Latitude parameter name
static const std::string& longitude; //! Test system Longitude parameter name
static const std::string& expiry; //! Test system GeoNetworking Lifetime parameter name (in ms)
static const std::string& station_id; //! To indicate to the peer ITS_Container::stationID
static const std::string& device_mode; //! To indicate to the lower layer to act as a standalone device
static const std::string& secured_mode; //! To indicate to the lower layer to apply signature on message exchanges as defined in IEEE 1609.2 & ETSI TS 102 965
static const std::string& encrypted_mode; //! To indicate to the lower layer to apply encryption on message exchanges as defined in IEEE 1609.2 & ETSI TS 102 965
static const std::string& enable_security_checks;//! To indicates if security check failures shall be treated as error or warning
static const std::string& sec_db_path; //! Path to the folder containing certificates
static const std::string& certificate; //! The certificate identifier the Test System shall use. E.g. CERT_TS_A
static const std::string& peer_certificate; //! The peer certificate identifier the Test System shall use for encryption. E.g. CERT_TS_A
static const std::string& hash; //! The digest algorithm the Test System shall use, authorised values are SHA-256 or SHA-384. Default: SHA-256
static const std::string& signature; //! The signature algorithm the Test System shall use, authorised values are NISTP-256, BP-256 and BP-384. Default: NISTP-256
static const std::string& cypher; //! The encryption algorithm the Test System shall use, authorised values are NISTP-256 and BP-256. Default: NISTP-256
static const std::string& distanceA; //! Test system GeoNetworking DistanceA parameter name
static const std::string& distanceB; //! Test system GeoNetworking DistanceB parameter name
static const std::string& angle; //! Test system GeoNetworking Angle parameter name
static const std::string& payload_type; //! Tyoe of payload, value is the ITS Conatainer message identifier or omitted in case of unknown payload
static const std::string& next_header; //! Upper layer settings
static const std::string& header_type; //! Upper layer settings
static const std::string& header_sub_type; //! Upper layer settings
static const std::string& interface_id; //! Commsignia antenna selector
static const std::string& server; //! HTTP server address (e.g. www.etsi.org)
static const std::string& port; //! HTTP server port. Default: 80
static const std::string& use_ssl; //! Set to 1 to use SSL to communicate with the HTTP server. Default: false
......@@ -45,10 +89,6 @@ public: //! \publicsection
static const std::string& host; //! HTTP Host value. Default: 127.0.0.1
static const std::string& content_type; //! HTTP Content-type value. Default: application/text
static const std::string& sip_url;
static const std::string& sip_version;
static const std::string& payload; //! UpperLayer Payload parameter name
static const std::string& codecs; //! List of codecs to use for HTTP application layers
/*!
......
sources := src/base_time.cc \
src/codec_stack_builder.cc \
src/converter.cc \
src/layer_factory.cc \
src/params.cc
includes += ./include
......@@ -22,12 +22,53 @@ const std::string& params::mac_src = std::string("mac_src");
const std::string& params::mac_dst = std::string("mac_dst");
const std::string& params::mac_bc = std::string("mac_bc");
const std::string& params::eth_type = std::string("eth_type");
const std::string& params::beaconing = std::string("beaconing");
const std::string& params::timestamp = std::string("timestamp");
const std::string& params::station_type = std::string("station_type");
const std::string& params::country = std::string("country");
const std::string& params::type_of_address = std::string("type_of_address");
const std::string& params::its_aid = std::string("its_aid");
const std::string& params::ssp = std::string("ssp");
const std::string& params::gn_payload = std::string("gn_payload");
const std::string& params::gn_next_header = std::string("gnNextHeader");
const std::string& params::gn_header_type = std::string("gnHeaderType");
const std::string& params::gn_header_sub_type = std::string("gnHeaderSubtype");
const std::string& params::gn_lifetime = std::string("gnLifetime");
const std::string& params::gn_traffic_class = std::string("gnTrafficClass");
const std::string& params::btp_type = std::string("btp_type");
const std::string& params::btp_payload = std::string("btp_payload");
const std::string& params::btp_destination_port = std::string("dst_port");
const std::string& params::btp_info = std::string("btp_info");
const std::string& params::nic = std::string("nic");
const std::string& params::latitude = std::string("latitude");
const std::string& params::longitude = std::string("longitude");
const std::string& params::ll_address = std::string("ll_address");
const std::string& params::expiry = std::string("expiry");
const std::string& params::station_id = std::string("station_id");
const std::string& params::device_mode = std::string("device_mode");
const std::string& params::secured_mode = std::string("secured_mode");
const std::string& params::encrypted_mode = std::string("encrypted_mode");
const std::string& params::enable_security_checks = std::string("enable_security_checks");
const std::string& params::certificate = std::string("certificate");
const std::string& params::peer_certificate = std::string("peer_certificate");
const std::string& params::sec_db_path = std::string("sec_db_path");
const std::string& params::hash = std::string("hash");
const std::string& params::signature = std::string("signature");
const std::string& params::cypher = std::string("cypher");
const std::string& params::distanceA = std::string("distanceA");
const std::string& params::distanceB = std::string("distanceB");
const std::string& params::angle = std::string("angle");
const std::string& params::payload_type = std::string("payload_type");
const std::string& params::next_header = std::string("next_header");
const std::string& params::header_type = std::string("header_type");
const std::string& params::header_sub_type = std::string("header_sub_type");
const std::string& params::interface_id = std::string("interface_id");
const std::string& params::server = std::string("server");
const std::string& params::port = std::string("port");
......@@ -40,9 +81,9 @@ const std::string& params::uri = std::string("uri");
const std::string& params::host = std::string("host");
const std::string& params::content_type = std::string("content_type");
const std::string& params::sip_url = std::string("sip_url");
const std::string& params::sip_version = std::string("sip_version");
const std::string& params::payload = std::string("payload");
//const std::string& params::sip_url = std::string("sip_url");
//const std::string& params::sip_version = std::string("sip_version");
//const std::string& params::payload = std::string("payload");
const std::string& params::codecs = std::string("codecs");
......
sources := HttpPort.cc
includes := .
sources := ethernet_layer.cc
includes := .
......@@ -563,7 +563,7 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
os += OCTETSTRING(len, counter + static_cast<const unsigned char*>(body));
loggers::get_instance().log_msg("http_codec::decode_body: os=", os);
counter += len;
loggers::get_instance().log("http_codec::decode_body: Chunked: %02x %02x %02x", body[counter].get_octet(), body[counter + 1].get_octet(), body[counter + 2].get_octet());
//loggers::get_instance().log("http_codec::decode_body: Chunked: %02x %02x %02x", body[counter].get_octet(), body[counter + 1].get_octet(), body[counter + 2].get_octet());
loggers::get_instance().log("http_codec::decode_body: Chunked (2): prev = %d, counter=%d / %d", prev, counter, body.lengthof());
while (counter < body.lengthof() && ((body[counter].get_octet() == '\r') || (body[counter].get_octet() == '\n'))) { // Skip additional \n
counter += 1;
......
sources := http_codec.cc http_layer.cc
includes := .
......@@ -64,6 +64,26 @@ int json_codec::encode (const LibItsHttp__JsonMessageBodyTypes::JsonBody& msg, O
const AppEnablementAPI__TypesAndValues::TrafficRule& traffic_rule = msg.trafficRule();
traffic_rule.encode(AppEnablementAPI__TypesAndValues::TrafficRule_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"TrafficRule\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_bwInfo)) {
const TrafficManagementAPI__TypesAndValues::BwInfo& bw_info = msg.bwInfo();
bw_info.encode(TrafficManagementAPI__TypesAndValues::BwInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"TrafficRule\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_mtsSessionInfo)) {
const TrafficManagementAPI__TypesAndValues::MtsSessionInfo& mts_session_info = msg.mtsSessionInfo();
mts_session_info.encode(TrafficManagementAPI__TypesAndValues::MtsSessionInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"TrafficRule\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_predictedQos)) {
const V2XInformationServiceAPI__TypesAndValues::PredictedQos& predicted_qos = msg.predictedQos();
predicted_qos.encode(V2XInformationServiceAPI__TypesAndValues::PredictedQos_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"TrafficRule\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_assocStaSubscription)) {
const WlanInformationAPI__TypesAndValues::AssocStaSubscription& assoc_sta_subscription = msg.assocStaSubscription();
assoc_sta_subscription.encode(WlanInformationAPI__TypesAndValues::AssocStaSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"TrafficRule\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_staDataRateSubscription)) {
const WlanInformationAPI__TypesAndValues::StaDataRateSubscription& sta_data_rate_subscription = msg.staDataRateSubscription();
sta_data_rate_subscription.encode(WlanInformationAPI__TypesAndValues::StaDataRateSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"TrafficRule\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
} else {
loggers::get_instance().error("json_codec::encode: Not supported");
}
......@@ -105,8 +125,8 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
loggers::get_instance().log("json_codec::decode: decoding_buffer='%c' / '%s'", str[0], str.c_str());
TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
if (it->second.find("\"userList\"") != std::string::npos) { // Be careful to the order
// TODO To be refined, find("\"userList\"") is not optimal
if (it->second.find("\"userList\"") != std::string::npos) { // Be careful to the order
// TODO To be refined, find("\"userList\"") is not optimal
int idx_begin = it->second.find(":");
int idx_end = it->second.rfind("}") - 1; // Remove the last '}'
str = it->second.substr(idx_begin + 1, idx_end - idx_begin);
......@@ -115,7 +135,7 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
user_list.decode(LocationAPI__TypesAndValues::UserList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.userList() = user_list;
} else if (it->second.find("\"accessPointList\"") != std::string::npos) { // Be careful to the order
// TODO To be refined, find("\"accessPointList\"") is not optimal
// TODO To be refined, find("\"accessPointList\"") is not optimal
LocationAPI__TypesAndValues::AccessPointList access_point_list;
access_point_list.decode(LocationAPI__TypesAndValues::AccessPointList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.accessPointList() = access_point_list;
......@@ -208,7 +228,7 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
AppEnablementAPI__TypesAndValues::SubscriptionLinkList sub_link_list;
sub_link_list.decode(AppEnablementAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.subscriptionLinkList__app__ens() = sub_link_list;
} else if (it->second.find("\"subscriptionType\"") != std::string::npos) {
} else if ((it->second.find("\"subscriptionType\"") != std::string::npos) && (it->second.find("\"filteringCriteria\"") != std::string::npos)) {
AppEnablementAPI__TypesAndValues::SerAvailabilityNotificationSubscription ser_av;
ser_av.decode(AppEnablementAPI__TypesAndValues::SerAvailabilityNotificationSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.serAvailabilityNotificationSubscription() = ser_av;
......@@ -221,123 +241,123 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
current_time.decode(AppEnablementAPI__TypesAndValues::CurrentTime_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.currentTime() = current_time;
} else if (it->second.find("\"CellChangeSubscription\"") != std::string::npos) {
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// //loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// //loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
RnisAPI__TypesAndValues::CellChangeSubscription cell_change_subscription;
cell_change_subscription.decode(RnisAPI__TypesAndValues::CellChangeSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.cellChangeSubscription() = cell_change_subscription;
//TODO Continue with other ChangeSubscription
} else if (it->second.find("\"RabInfo\"") != std::string::npos) {
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// // loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// // loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
RnisAPI__TypesAndValues::RabInfo rab_info;
rab_info.decode(RnisAPI__TypesAndValues::RabInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.rabInfo() = rab_info;
} else if (it->second.find("\"S1BearerInfo\"") != std::string::npos) {
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// // loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// // loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);