Newer
Older
#include "ConfigRsuSimulatorLayerFactory.hh"
#include "loggers.hh"
#include "ItsRSUsSimulator_TestSystem.hh"
#include "LibItsIvim_EncdecDeclarations.hh"
#include "LibItsMapemSpatem_EncdecDeclarations.hh"
#include "LibItsSremSsem_EncdecDeclarations.hh"
ConfigRsuSimulatorLayer::ConfigRsuSimulatorLayer(const std::string & p_type, const std::string & param) : t_layer<ItsRSUsSimulator__TestSystem::ConfigRsuSimulatorPort>(p_type), _params(), _codec(), _codec_cam() {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::ConfigRsuSimulatorLayer: %s, %s", to_string().c_str(), param.c_str());
// Setup parameters
void ConfigRsuSimulatorLayer::sendMsg(const ItsRSUsSimulator__TestSystem::CfInitialize& send_par, params& params){
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
// Encode ConfigRsuSimulator PDU
OCTETSTRING data;
if (_codec.encode(static_cast<const Record_Type&>(send_par), data) == -1) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Encoding failure");
return;
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnResults& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::UtGnResults::ALT_utGnInitializeResult)) {
encoding_buffer.put_c(0x01/*static_cast<const unsigned char>(uppertester_geonetworking_codec::c_utGnInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utGnInitializeResult()));
} else if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::UtGnResults::ALT_utGnTriggerResult)) {
encoding_buffer.put_c(0x41/*static_cast<const unsigned char>(uppertester_geonetworking_codec::c_utGnTriggerResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utGnTriggerResult()));
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtGnResults variant");
return;
}
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnEventInd& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
encoding_buffer.put_c(0x55/*static_cast<const unsigned char>(uppertester_geonetworking_codec::c_utGnEventInd)*/);
OCTETSTRING l = int2oct(send_par.rawPayload().lengthof(), 2);
encoding_buffer.put_s(l.lengthof(), static_cast<const unsigned char*>(l));
encoding_buffer.put_s(send_par.rawPayload().lengthof(), static_cast<const unsigned char*>(send_par.rawPayload()));
OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(data, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsCam__TypesAndValues::UtCamResults& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
if (send_par.ischosen(LibItsCam__TypesAndValues::UtCamResults::ALT_utCamInitializeResult)) {
encoding_buffer.put_c(0x01/*static_cast<const unsigned char>(uppertester_cam_codec::c_utCamInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utCamInitializeResult()));
} else if (send_par.ischosen(LibItsCam__TypesAndValues::UtCamResults::ALT_utCamTriggerResult)) {
encoding_buffer.put_c(0x21/*static_cast<const unsigned char>(uppertester_cam_codec::c_utCamTriggerResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utCamTriggerResult()));
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtCamResults variant");
return;
}
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsCam__TypesAndValues::UtCamEventInd& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
encoding_buffer.put_c(0x23/*static_cast<const unsigned char>(uppertester_cam_codec::c_utCamEventInd)*/);
BITSTRING bs = LibItsCam__EncdecDeclarations::fx__enc__CAM(send_par.camMsg());
OCTETSTRING os = bit2oct(bs);
OCTETSTRING l = int2oct(os.lengthof(), 2);
encoding_buffer.put_s(l.lengthof(), static_cast<const unsigned char*>(l));
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(data, _params);
void ConfigRsuSimulatorLayer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmResults& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
if (send_par.ischosen(LibItsDenm__TypesAndValues::UtDenmResults::ALT_utDenmInitializeResult)) {
encoding_buffer.put_c(0x01/*static_cast<const unsigned char>(uppertester_denm_codec::c_utDenmInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utDenmInitializeResult()));
} else if (send_par.ischosen(LibItsDenm__TypesAndValues::UtDenmResults::ALT_utDenmTriggerResult)) {
encoding_buffer.put_c(0x11/*static_cast<const unsigned char>(uppertester_denm_codec::c_utDenmTriggerResult)*/);
const LibItsDenm__TypesAndValues::UtDenmTriggerResult& r = send_par.utDenmTriggerResult();
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(r.result()));
OCTETSTRING os = int2oct(r.actionId().originatingStationID(), 4);
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
os = int2oct(r.actionId().sequenceNumber(), 2);
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
} else if (send_par.ischosen(LibItsDenm__TypesAndValues::UtDenmResults::ALT_utDenmUpdateResult)) {
encoding_buffer.put_c(0x13/*static_cast<const unsigned char>(uppertester_denm_codec::c_utDenmUpdateResult)*/);
const LibItsDenm__TypesAndValues::UtDenmUpdateResult& r = send_par.utDenmUpdateResult();
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(r.result()));
OCTETSTRING os = int2oct(r.actionId().originatingStationID(), 4);
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
os = int2oct(r.actionId().sequenceNumber(), 2);
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
} else if (send_par.ischosen(LibItsDenm__TypesAndValues::UtDenmResults::ALT_utDenmTerminationResult)) {
encoding_buffer.put_c(0x15/*static_cast<const unsigned char>(uppertester_denm_codec::c_utDenmInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utDenmTerminationResult()));
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtDenmResults variant");
return;
}
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmEventInd& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
encoding_buffer.put_c(0x17/*static_cast<const unsigned char>(uppertester_cam_codec::c_utDenmEventInd)*/);
BITSTRING bs = LibItsDenm__EncdecDeclarations::fx__enc__DENM(send_par.denMsg());
OCTETSTRING os = bit2oct(bs);
OCTETSTRING l = int2oct(os.lengthof(), 2);
encoding_buffer.put_s(l.lengthof(), static_cast<const unsigned char*>(l));
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(data, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsPki__TypesAndValues::UtPkiResults& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
if (send_par.ischosen(LibItsPki__TypesAndValues::UtPkiResults::ALT_utPkiInitializeResult)) {
encoding_buffer.put_c(0x01/*static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utPkiInitializeResult()));
} else if (send_par.ischosen(LibItsPki__TypesAndValues::UtPkiResults::ALT_utPkiTriggerResult)) {
encoding_buffer.put_c(0xB0/*static_cast<const unsigned char>(uppertester_pki_codec::c_utPkiTriggerResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utPkiTriggerResult()));
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtPkiResults variant");
return;
}
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimResults& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
if (send_par.ischosen(LibItsIvim__TypesAndValues::UtIvimResults::ALT_utIvimInitializeResult)) {
encoding_buffer.put_c(0x01/*static_cast<const unsigned char>(uppertester_pki_codec::c_utIvimInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utIvimInitializeResult()));
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtIvimResults variant");
return;
}
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimEventInd& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
encoding_buffer.put_c(0x23/*static_cast<const unsigned char>(uppertester_cam_codec::c_utIvimEventInd)*/);
BITSTRING bs = LibItsIvim__EncdecDeclarations::fx__enc__IVIM(send_par.iviMsg());
OCTETSTRING os = bit2oct(bs);
OCTETSTRING l = int2oct(os.lengthof(), 2);
encoding_buffer.put_s(l.lengthof(), static_cast<const unsigned char*>(l));
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(data, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
if (send_par.ischosen(LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults::ALT_utMapemSpatemInitializeResult)) {
encoding_buffer.put_c(0x01/*static_cast<const unsigned char>(uppertester_pki_codec::c_utMapemSpatemInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utMapemSpatemInitializeResult()));
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtMapemSpatemResults variant");
return;
}
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremResults& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
if (send_par.ischosen(LibItsSremSsem__TypesAndValues::UtSremResults::ALT_utSremInitializeResult)) {
encoding_buffer.put_c(0x01/*static_cast<const unsigned char>(uppertester_pki_codec::c_utSremInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utSremInitializeResult()));
} else if (send_par.ischosen(LibItsSremSsem__TypesAndValues::UtSremResults::ALT_utSremTriggerResult)) {
encoding_buffer.put_c(0xa1/*static_cast<const unsigned char>(uppertester_pki_codec::c_utSremTriggerResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utSremTriggerResult()));
} else if (send_par.ischosen(LibItsSremSsem__TypesAndValues::UtSremResults::ALT_utSremUpdateResult)) {
encoding_buffer.put_c(0xa3/*static_cast<const unsigned char>(uppertester_pki_codec::c_utSremUpdateResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utSremUpdateResult()));
} else if (send_par.ischosen(LibItsSremSsem__TypesAndValues::UtSremResults::ALT_utSremCancelationResult)) {
encoding_buffer.put_c(0xa5/*static_cast<const unsigned char>(uppertester_pki_codec::c_utSremCancelationResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utSremCancelationResult()));
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtSremResults variant");
return;
}
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremEventInd& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
encoding_buffer.put_c(0xa6/*static_cast<const unsigned char>(uppertester_sremssem_codec::c_utSremEventInd)*/);
BITSTRING bs = LibItsSremSsem__EncdecDeclarations::fx__enc__SREM(send_par.sreMsg());
OCTETSTRING os = bit2oct(bs);
OCTETSTRING l = int2oct(os.lengthof(), 2);
encoding_buffer.put_s(l.lengthof(), static_cast<const unsigned char*>(l));
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(data, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSsemEventInd& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
encoding_buffer.put_c(0xa7/*static_cast<const unsigned char>(uppertester_sremssem_codec::c_utSsemEventInd)*/);
BITSTRING bs = LibItsSremSsem__EncdecDeclarations::fx__enc__SSEM(send_par.sseMsg());
OCTETSTRING os = bit2oct(bs);
OCTETSTRING l = int2oct(os.lengthof(), 2);
encoding_buffer.put_s(l.lengthof(), static_cast<const unsigned char*>(l));
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(data, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemResults& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
if (send_par.ischosen(LibItsRtcmem__TypesAndValues::UtRtcmemResults::ALT_utRtcmemInitializeResult)) {
encoding_buffer.put_c(0x01/*static_cast<const unsigned char>(uppertester_pki_codec::c_utRtcmemInitializeResult)*/);
encoding_buffer.put_c((unsigned char)static_cast<const boolean>(send_par.utRtcmemInitializeResult()));
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtRtcmemResults variant");
return;
}
OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(os, _params);
}
void ConfigRsuSimulatorLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemEventInd& send_par, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par);
TTCN_Buffer encoding_buffer;
encoding_buffer.put_c(0x23/*static_cast<const unsigned char>(uppertester_cam_codec::c_utRtcmemEventInd)*/);
BITSTRING bs = LibItsRtcmem__EncdecDeclarations::fx__enc__RTCMEM(send_par.rtcmemMsg());
OCTETSTRING os = bit2oct(bs);
OCTETSTRING l = int2oct(os.lengthof(), 2);
encoding_buffer.put_s(l.lengthof(), static_cast<const unsigned char*>(l));
encoding_buffer.put_s(os.lengthof(), static_cast<const unsigned char*>(os));
OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data());
send_data(data, _params);
}
void ConfigRsuSimulatorLayer::send_data(OCTETSTRING& data, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::send_data: ", data);
void ConfigRsuSimulatorLayer::receive_data(OCTETSTRING& data, params& params)
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::receive_data: ", data);
unsigned char id = *(static_cast<const unsigned char*>(data));
if (id == 0x00) { // Receive an UtxxInitialise
process_utinitialize_data(data, params);
} else if (id == 0x30/*uppertester_cam_codec::c_utCamChangeCurvature*/) {
process_ut_cam_changecurvature_data(data, params);
} else if (id == 0x31/*uppertester_cam_codec::c_utCamChangeSpeed*/) {
process_ut_cam_changespeed_data(data, params);
} else if (id == 0x34/*uppertester_cam_codec::c_utCamChangeHeading*/) {
process_ut_cam_changeheading_data(data, params);
} else if (id == 0x3a/*uppertester_cam_codec::c_utCamSetVehicleRole*/) {
process_ut_cam_setvehiclerole_data(data, params);
} else if (id == 0x10/*uppertester_denm_codec::c_utDenmTrigger*/) {
process_ut_denm_trigger(data, params);
} else if (id == 0x12/*uppertester_denm_codec::c_utDenmUpdate*/) {
process_ut_denm_update(data, params);
} else if (id == 0x14/*uppertester_denm_codec::c_utDenmTermination*/) {
process_ut_denm_termination(data, params);
} else if (id == 0xa0/*uppertester_sremssem_codec::c_utSremTrigger*/) {
process_ut_srem_trigger(data, params);
} else if (id == 0xa2/*uppertester_sremssem_codec::c_utSremUpdate*/) {
process_ut_srem_update(data, params);
} else if (id == 0xa4/*uppertester_sremssem_codec::c_utSremCancelation*/) {
process_ut_srem_termination(data, params);
} else if ((id >= 0x50) && (id <= 0x54)) { // Receive an UtGnTrigger
process_ut_geonetworking_trigger(data, params);
} else if ((id >= 0xBB) && (id <= 0xBF)) { // Receive an UtPkiTrigger
process_ut_pki_trigger(data, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::receive_data: Unsupported tag %02x", id);
int ConfigRsuSimulatorLayer::process_utinitialize_data(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_utinitialize_data");
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_utinitialize_data: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("gn") == 0) {
OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsGeoNetworking__TypesAndValues::UtGnInitialize p(hashedId);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else if (_params[std::string("ut")].compare("cam") == 0) {
OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsCam__TypesAndValues::UtCamInitialize p(hashedId);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else if (_params[std::string("ut")].compare("denm") == 0) {
OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsDenm__TypesAndValues::UtDenmInitialize p(hashedId);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else if (_params[std::string("ut")].compare("pki") == 0) {
OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsPki__TypesAndValues::UtPkiInitialize p(hashedId);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else if (_params[std::string("ut")].compare("ivim") == 0) {
OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsIvim__TypesAndValues::UtIvimInitialize p(hashedId);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else if (_params[std::string("ut")].compare("mapemspatem") == 0) {
OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsMapemSpatem__TypesAndValues::UtMapemSpatemInitialize p(hashedId);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else if (_params[std::string("ut")].compare("sremssem") == 0) {
OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsSremSsem__TypesAndValues::UtSremInitialize p(hashedId);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else if (_params[std::string("ut")].compare("rtcmem") == 0) {
OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsRtcmem__TypesAndValues::UtRtcmemInitialize p(hashedId);
// Pass it to the ports if any
to_all_upper_ports(p, params);
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_utinitialize_data: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_cam_changespeed_data(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_cam_changespeed_data");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_changespeed_data: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("cam") == 0) {
OCTETSTRING speed(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsCam__TypesAndValues::UtCamTrigger p;
p.changeSpeed() = oct2int(speed);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_changespeed_data: Unsupported protocol");
return -1;
}
return 0;
int ConfigRsuSimulatorLayer::process_ut_cam_changecurvature_data(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_cam_changecurvature_data");
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_changecurvature_data: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("cam") == 0) {
OCTETSTRING curvature(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_changecurvature_data: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_cam_changeheading_data(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_cam_changeheading_data");
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_changeheading_data: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("cam") == 0) {
OCTETSTRING heading(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsCam__TypesAndValues::UtCamTrigger p;
p.changeHeading() = oct2int(heading);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_changeheading_data: Unsupported protocol");
return -1;
}
return 0;
}
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
int ConfigRsuSimulatorLayer::process_ut_cam_setvehiclerole_data(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_cam_setvehiclerole_data");
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_setvehiclerole_data: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("cam") == 0) {
OCTETSTRING vehicle_role(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
LibItsCam__TypesAndValues::UtCamTrigger p;
p.setVehicleRole() = oct2int(vehicle_role);
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_setvehiclerole_data: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_denm_trigger(const OCTETSTRING& data, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::process_ut_denm_trigger", data);
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_denm_trigger: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("denm") == 0) {
unsigned char* p = (unsigned char*)static_cast<const unsigned char*>(data);
unsigned char msg_id = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_trigger: msg_id=%02x", msg_id);
unsigned char flag = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_trigger: flag=%02x", flag);
LibItsDenm__TypesAndValues::UtDenmTrigger trigger; // See ETSI TR 103 34 099 Cause C.4.1 GenerateDenmEvent
// Decode detectionTime
trigger.detectionTime() = oct2int(OCTETSTRING(6, p));
p += 6;
// ValidityDuration
if ((flag & 0x80) == 0x80) {
trigger.validityDuration() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(3, p)));
} else {
trigger.validityDuration().set_to_omit();
}
p += 3;
if ((flag & 0x40) == 0x40) {
trigger.repetitionDuration() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(3, p)));
} else {
trigger.repetitionDuration().set_to_omit();
}
p += 3;
// Situation
trigger.situation().informationQuality() = oct2int(OCTETSTRING(1, p++));
trigger.situation().eventType().causeCode() = oct2int(OCTETSTRING(1, p++));
trigger.situation().eventType().subCauseCode() = oct2int(OCTETSTRING(1, p++));
trigger.situation().linkedCause().set_to_omit();
trigger.situation().eventHistory().set_to_omit();
// RelevanceDistance
trigger.relevanceDistance() = oct2int(OCTETSTRING(1, p++));
// RelevanceTrafficDirection
trigger.relevanceTrafficDirection() = oct2int(OCTETSTRING(1, p++));
if ((flag & 0x04) == 0x04) {
trigger.transmissionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
} else {
trigger.transmissionInterval().set_to_omit();
}
p += 2;
if ((flag & 0x02) == 0x02) {
trigger.repetitionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
} else {
trigger.repetitionInterval().set_to_omit();
}
p += 2;
// alacarteLength
INTEGER alacarte_length = oct2int(OCTETSTRING(1, p));
if (static_cast<int>(alacarte_length) != 0) {
p += 1;
// FIXME AlacarteContainer alacarte optional
} else {
trigger.alacarte().set_to_omit();
}
loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_denm_trigger: ", trigger);
// Pass it to the ports if any
to_all_upper_ports(trigger, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_denm_trigger: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_denm_update(const OCTETSTRING& data, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::process_ut_denm_update", data);
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_denm_update: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("denm") == 0) {
unsigned char* p = (unsigned char*)static_cast<const unsigned char*>(data);
unsigned char msg_id = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_update: msg_id=%02x", msg_id);
unsigned char flag = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_update: flag=%02x", flag);
LibItsDenm__TypesAndValues::UtDenmUpdate update; // See ETSI TR 103 34 099 Cause C.4.1 GenerateDenmEvent
// Statuion ID
update.actionId().originatingStationID() = oct2int(OCTETSTRING(4, p));
p += 4;
// SequenceNumber
update.actionId().sequenceNumber() = oct2int(OCTETSTRING(2, p));
p += 2;
// Decode detectionTime
update.detectionTime() = oct2int(OCTETSTRING(6, p));
p += 6;
if ((flag & 0x80) == 0x80) {
update.validityDuration() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(3, p)));
} else {
update.validityDuration().set_to_omit();
}
p += 3;
// Situation
if ((flag & 0x40) == 0x40) {
DENM__PDU__Descriptions::SituationContainer& s = static_cast<DENM__PDU__Descriptions::SituationContainer &>(*update.get_opt_value());
s.informationQuality() = oct2int(OCTETSTRING(1, p++));
s.eventType().causeCode() = oct2int(OCTETSTRING(1, p++));
s.eventType().subCauseCode() = oct2int(OCTETSTRING(1, p++));
s.linkedCause().set_to_omit();
s.eventHistory().set_to_omit();
update.situation() = OPTIONAL<DENM__PDU__Descriptions::SituationContainer>(s);
} else {
update.situation().set_to_omit();
}
// Location
update.location().set_to_omit();
// RelevanceDistance
if ((flag & 0x20) == 0x20) {
update.relevanceDistance() = oct2int(OCTETSTRING(1, p++));
} else {
update.relevanceDistance().set_to_omit();
}
// RelevanceTrafficDirection
if ((flag & 0x10) == 0x10) {
update.relevanceTrafficDirection() = oct2int(OCTETSTRING(1, p++));
} else {
update.relevanceTrafficDirection().set_to_omit();
}
if ((flag & 0x08) == 0x08) {
update.transmissionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
} else {
update.transmissionInterval().set_to_omit();
}
p += 2;
if ((flag & 0x04) == 0x04) {
update.repetitionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
} else {
update.repetitionInterval().set_to_omit();
}
p += 2;
// alacarteLength
INTEGER alacarte_length = oct2int(OCTETSTRING(1, p));
if (static_cast<int>(alacarte_length) != 0) {
p += 1;
// FIXME AlacarteContainer alacarte optional
} else {
update.alacarte().set_to_omit();
}
loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_denm_update: ", update);
// Pass it to the ports if any
to_all_upper_ports(update, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_denm_update: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_denm_termination(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_denm_termination");
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_denm_termination: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("denm") == 0) {
unsigned char* p = (unsigned char*)static_cast<const unsigned char*>(data);
unsigned char msg_id = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_termination: msg_id=%02x", msg_id);
LibItsDenm__TypesAndValues::UtDenmTermination termination;
termination.actionId().originatingStationID() = oct2int(OCTETSTRING(4, p));
p += 4;
termination.actionId().sequenceNumber() = oct2int(OCTETSTRING(2, p));
// Pass it to the ports if any
to_all_upper_ports(termination, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_denm_termination: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger");
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("gn") == 0) {
unsigned char msg_id = *static_cast<const unsigned char*>(data);
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: msg_id=%02x", msg_id);
OCTETSTRING payload(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: payload:", payload);
TTCN_EncDec::clear_error();
TTCN_Buffer decoding_buffer(payload);
if (msg_id == 0x50/*uppertester_geonetworking_codec::c_utGnTrigger_GeoUnicast*/) {
LibItsGeoNetworking__TypesAndValues::GenerateGeoUnicastMessage g;
g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW);
if(g.payload().lengthof() > 2) {
g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast<const unsigned char*>(g.payload()));
} else {
g.payload() = OCTETSTRING(0, nullptr);
}
p.geoUnicast() = g;
} else if (msg_id == 0x51/*uppertester_geonetworking_codec::c_utGnTrigger_GeoBroadcast*/) {
LibItsGeoNetworking__TypesAndValues::GenerateGeoBroadcastMessage g;
g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW);
if(g.payload().lengthof() > 2) {
g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast<const unsigned char*>(g.payload()));
} else {
g.payload() = OCTETSTRING(0, nullptr);
}
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
} else if (msg_id == 0x52/*uppertester_geonetworking_codec::c_utGnTrigger_GeoAnycast*/) {
LibItsGeoNetworking__TypesAndValues::GenerateGeoAnycastMessage g;
g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW);
if(g.payload().lengthof() > 2) {
g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast<const unsigned char*>(g.payload()));
} else {
g.payload() = OCTETSTRING(0, nullptr);
}
p.geoAnycast() = g;
} else if (msg_id == 0x53/*uppertester_geonetworking_codec::c_utGnTrigger_Shb*/) {
LibItsGeoNetworking__TypesAndValues::GenerateSHBMessage g;
g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW);
if(g.payload().lengthof() > 2) {
g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast<const unsigned char*>(g.payload()));
} else {
g.payload() = OCTETSTRING(0, nullptr);
}
p.shb() = g;
} else if (msg_id == 0x54/*uppertester_geonetworking_codec::c_utGnTrigger_Tsb*/) {
LibItsGeoNetworking__TypesAndValues::GenerateTSBMessage g;
g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW);
if(g.payload().lengthof() > 2) {
g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast<const unsigned char*>(g.payload()));
} else {
g.payload() = OCTETSTRING(0, nullptr);
}
p.tsb() = g;
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_pki_trigger(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_pki_trigger");
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_pki_trigger: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("pki") == 0) {
unsigned char msg_id = *static_cast<const unsigned char*>(data);
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: msg_id=%02x", msg_id);
OCTETSTRING payload(data.lengthof() - 1, 1 + static_cast<const unsigned char*>(data));
loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: payload:", payload);
TTCN_EncDec::clear_error();
TTCN_Buffer decoding_buffer(payload);
if (msg_id == 0xbb/*uppertester_pki_codec*/) {
// LibItsPki__TypesAndValues::TriggerEnrolmentRequest e;
// e.decode(*e.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW);
//p.triggerEnrolmentRequest() = e;
p.triggerEnrolmentRequest().cannonicalId() = OCTETSTRING(0, nullptr); // No parameter used
p.triggerEnrolmentRequest().encAlgorithm() = OCTETSTRING(0, nullptr); // No parameter used
p.triggerEnrolmentRequest().privateKey() = OCTETSTRING(0, nullptr); // No parameter used
p.triggerEnrolmentRequest().compressedPublickey() = OCTETSTRING(0, nullptr); // No parameter used
} else if (msg_id == 0xbc/*uppertester_pki_codec*/) {
// LibItsPki__TypesAndValues::TriggerAuthorizationRequest e;
// e.decode(*e.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW);
//p.triggerAuthorizationRequest() = e;
p.triggerAuthorizationRequest().cannonicalId() = OCTETSTRING(0, nullptr); // No parameter used
p.triggerAuthorizationRequest().encAlgorithm() = OCTETSTRING(0, nullptr); // No parameter used
p.triggerAuthorizationRequest().privateKey() = OCTETSTRING(0, nullptr); // No parameter used
p.triggerAuthorizationRequest().compressedPublickey() = OCTETSTRING(0, nullptr); // No parameter used
// Pass it to the ports if any
to_all_upper_ports(p, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_pki_trigger: Unsupported protocol");
return -1;
}
return 0;
}
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
int ConfigRsuSimulatorLayer::process_ut_ivim_trigger(const OCTETSTRING& data, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::process_ut_ivim_trigger", data);
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_ivim_trigger: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("ivim") == 0) {
unsigned char* p = (unsigned char*)static_cast<const unsigned char*>(data);
unsigned char msg_id = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_trigger: msg_id=%02x", msg_id);
unsigned char flag = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_trigger: flag=%02x", flag);
LibItsIvim__TypesAndValues::UtIvimTrigger trigger; // See ETSI TR 103 34 099 Cause C.4.1 GenerateIvimEvent
/* // Decode detectionTime
trigger.detectionTime() = oct2int(OCTETSTRING(6, p));
p += 6;
// ValidityDuration
if ((flag & 0x80) == 0x80) {
trigger.validityDuration() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(3, p)));
} else {
trigger.validityDuration().set_to_omit();
}
p += 3;
if ((flag & 0x40) == 0x40) {
trigger.repetitionDuration() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(3, p)));
} else {
trigger.repetitionDuration().set_to_omit();
}
p += 3;
// Situation
trigger.situation().informationQuality() = oct2int(OCTETSTRING(1, p++));
trigger.situation().eventType().causeCode() = oct2int(OCTETSTRING(1, p++));
trigger.situation().eventType().subCauseCode() = oct2int(OCTETSTRING(1, p++));
trigger.situation().linkedCause().set_to_omit();
trigger.situation().eventHistory().set_to_omit();
// RelevanceDistance
trigger.relevanceDistance() = oct2int(OCTETSTRING(1, p++));
// RelevanceTrafficDirection
trigger.relevanceTrafficDirection() = oct2int(OCTETSTRING(1, p++));
if ((flag & 0x04) == 0x04) {
trigger.transmissionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
} else {
trigger.transmissionInterval().set_to_omit();
}
p += 2;
if ((flag & 0x02) == 0x02) {
trigger.repetitionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
} else {
trigger.repetitionInterval().set_to_omit();
}
p += 2;
// alacarteLength
INTEGER alacarte_length = oct2int(OCTETSTRING(1, p));
if (static_cast<int>(alacarte_length) != 0) {
p += 1;
// FIXME AlacarteContainer alacarte optional
} else {
trigger.alacarte().set_to_omit();
}
loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_ivim_trigger: ", trigger);
*/
// Pass it to the ports if any
to_all_upper_ports(trigger, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_ivim_trigger: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_ivim_update(const OCTETSTRING& data, params& params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::process_ut_ivim_update", data);
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_ivim_update: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("ivim") == 0) {
unsigned char* p = (unsigned char*)static_cast<const unsigned char*>(data);
unsigned char msg_id = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_update: msg_id=%02x", msg_id);
unsigned char flag = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_update: flag=%02x", flag);
LibItsIvim__TypesAndValues::UtIvimUpdate update; // See ETSI TR 103 34 099 Cause C.4.1 GenerateIvimEvent
/* // Statuion ID
update.actionId().originatingStationID() = oct2int(OCTETSTRING(4, p));
p += 4;
// SequenceNumber
update.actionId().sequenceNumber() = oct2int(OCTETSTRING(2, p));
p += 2;
// Decode detectionTime
update.detectionTime() = oct2int(OCTETSTRING(6, p));
p += 6;
if ((flag & 0x80) == 0x80) {
update.validityDuration() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(3, p)));
} else {
update.validityDuration().set_to_omit();
}
p += 3;
// Situation
if ((flag & 0x40) == 0x40) {
DENM__PDU__Descriptions::SituationContainer& s = static_cast<DENM__PDU__Descriptions::SituationContainer &>(*update.get_opt_value());
s.informationQuality() = oct2int(OCTETSTRING(1, p++));
s.eventType().causeCode() = oct2int(OCTETSTRING(1, p++));
s.eventType().subCauseCode() = oct2int(OCTETSTRING(1, p++));
s.linkedCause().set_to_omit();
s.eventHistory().set_to_omit();
update.situation() = OPTIONAL<DENM__PDU__Descriptions::SituationContainer>(s);
} else {
update.situation().set_to_omit();
}
// Location
update.location().set_to_omit();
// RelevanceDistance
if ((flag & 0x20) == 0x20) {
update.relevanceDistance() = oct2int(OCTETSTRING(1, p++));
} else {
update.relevanceDistance().set_to_omit();
}
// RelevanceTrafficDirection
if ((flag & 0x10) == 0x10) {
update.relevanceTrafficDirection() = oct2int(OCTETSTRING(1, p++));
} else {
update.relevanceTrafficDirection().set_to_omit();
}
if ((flag & 0x08) == 0x08) {
update.transmissionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
} else {
update.transmissionInterval().set_to_omit();
}
p += 2;
if ((flag & 0x04) == 0x04) {
update.repetitionInterval() = OPTIONAL<INTEGER>(oct2int(OCTETSTRING(2, p)));
} else {
update.repetitionInterval().set_to_omit();
}
p += 2;
// alacarteLength
INTEGER alacarte_length = oct2int(OCTETSTRING(1, p));
if (static_cast<int>(alacarte_length) != 0) {
p += 1;
// FIXME AlacarteContainer alacarte optional
} else {
update.alacarte().set_to_omit();
}
loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_ivim_update: ", update);
*/
// Pass it to the ports if any
to_all_upper_ports(update, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_ivim_update: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_ivim_termination(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_ivim_termination");
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_ivim_termination: CF layer's ut parameter is missing");
return -1;
}
if (_params[std::string("ut")].compare("ivim") == 0) {
unsigned char* p = (unsigned char*)static_cast<const unsigned char*>(data);
unsigned char msg_id = *p++;
loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_termination: msg_id=%02x", msg_id);
LibItsIvim__TypesAndValues::UtIvimTermination termination;
/* termination.actionId().originatingStationID() = oct2int(OCTETSTRING(4, p));
p += 4;
termination.actionId().sequenceNumber() = oct2int(OCTETSTRING(2, p));
*/
// Pass it to the ports if any
to_all_upper_ports(termination, params);
} else {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_ivim_termination: Unsupported protocol");
return -1;
}
return 0;
}
int ConfigRsuSimulatorLayer::process_ut_srem_trigger(const OCTETSTRING& data, params& params) {
loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_srem_trigger");
params::const_iterator it = _params.find("ut");
if (it == _params.cend()) {
loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_srem_trigger: CF layer's ut parameter is missing");