Commit 20af6998 authored by Yann Garcia's avatar Yann Garcia
Browse files

Validate AtsSpatem

parent 3a98ae69
......@@ -11,49 +11,49 @@ class TTCN_EncDec;
int btp_codec::encode (const LibItsBtp__TypesAndValues::BtpPacket& msg, OCTETSTRING& data)
{
loggers::get_instance().log_msg(">>> btp_codec::encode: ", (const Base_Type&)msg);
//loggers::get_instance().log_msg(">>> btp_codec::encode: ", (const Base_Type&)msg);
TTCN_EncDec::clear_error();
TTCN_Buffer encoding_buffer;
encode_(msg, *msg.get_descriptor(), encoding_buffer);
data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data());
loggers::get_instance().log_msg("<<< btp_codec::encode: data=", data);
//loggers::get_instance().log_msg("<<< btp_codec::encode: data=", data);
return 0;
}
int btp_codec::encode_ (const Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& encoding_buffer)
{
loggers::get_instance().log(">>> btp_codec::encode_: processing %s/%s", type.get_descriptor()->name, field_descriptor.name);
loggers::get_instance().log_msg(">>> btp_codec::encode_: ", type);
//loggers::get_instance().log(">>> btp_codec::encode_: processing %s/%s", type.get_descriptor()->name, field_descriptor.name);
//loggers::get_instance().log_msg(">>> btp_codec::encode_: ", type);
if (dynamic_cast<const Record_Type *>(&type) != NULL) {
const Record_Type& r = (const Record_Type &)type;
loggers::get_instance().log("btp_codec::encode_: processing Record_Type %s", r.get_descriptor()->name);
//loggers::get_instance().log("btp_codec::encode_: processing Record_Type %s", r.get_descriptor()->name);
for(int i = 0; i < r.get_count(); i++) {
loggers::get_instance().log("btp_codec::encode_: processing %s/%s/%s - %d (1 ==> use dynamic_cast<const OPTIONAL<...>) - %d", r.fld_name(i), r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name, r.get_at(i)->is_optional(), r.get_at(i)->is_present());
//loggers::get_instance().log("btp_codec::encode_: processing %s/%s/%s - %d (1 ==> use dynamic_cast<const OPTIONAL<...>) - %d", r.fld_name(i), r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name, r.get_at(i)->is_optional(), r.get_at(i)->is_present());
if (r.get_at(i)->is_present()) {
if (encode_(*r.get_at(i), *r.fld_descr(i), encoding_buffer) == -1) {
loggers::get_instance().warning("btp_codec::encode_: -1 result code returned");
//loggers::get_instance().warning("btp_codec::encode_: -1 result code returned");
return -1;
}
}
} // End of 'for' statement
} else if (std::string(field_descriptor.name).compare("@LibItsBtp_TypesAndValues.BtpPacket.payload") == 0) {
const OPTIONAL<LibItsBtp__TypesAndValues::BtpRawPayload> &v = dynamic_cast<const OPTIONAL<LibItsBtp__TypesAndValues::BtpRawPayload> &>(type);
loggers::get_instance().log("btp_codec::encode_: BtpRawPayload present: %d", v.is_present());
//loggers::get_instance().log("btp_codec::encode_: BtpRawPayload present: %d", v.is_present());
if (v.is_present()) {
if (encode_(static_cast<const LibItsBtp__TypesAndValues::BtpRawPayload &>(*v.get_opt_value()), LibItsBtp__TypesAndValues::BtpRawPayload_descr_, encoding_buffer) == -1) {
loggers::get_instance().warning("btp_codec::encode_: -1 result code returned");
//loggers::get_instance().warning("btp_codec::encode_: -1 result code returned");
return -1;
}
}
} else {
loggers::get_instance().log("btp_codec::encode_ (else): processing type %s/%s", type.get_descriptor()->name, field_descriptor.name);
//loggers::get_instance().log("btp_codec::encode_ (else): processing type %s/%s", type.get_descriptor()->name, field_descriptor.name);
type.encode(field_descriptor, encoding_buffer, TTCN_EncDec::CT_RAW);
}
loggers::get_instance().log_to_hexa("<<<btp_codec::encode_: encoding_buffer=", encoding_buffer);
//loggers::get_instance().log_to_hexa("<<<btp_codec::encode_: encoding_buffer=", encoding_buffer);
return 0;
}
......@@ -63,30 +63,30 @@ int btp_codec::decode (const OCTETSTRING& data, LibItsBtp__TypesAndValues::BtpPa
TTCN_Buffer decoding_buffer(data);
_params = params;
loggers::get_instance().log_to_hexa(">>> btp_codec::decode: decoding_buffer=", decoding_buffer);
//loggers::get_instance().log_to_hexa(">>> btp_codec::decode: decoding_buffer=", decoding_buffer);
decode_(msg, *msg.get_descriptor(), decoding_buffer);
loggers::get_instance().log_msg("<<< btp_codec::decode: ", (const Base_Type&)msg);
//loggers::get_instance().log_msg("<<< btp_codec::decode: ", (const Base_Type&)msg);
return 0;
}
int btp_codec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& decoding_buffer)
{
loggers::get_instance().log(">>> btp_codec::decode_: processing %s/%s (%d,%d,%p)", type.get_descriptor()->name, field_descriptor.name, decoding_buffer.get_len(), decoding_buffer.get_pos(), decoding_buffer.get_read_data());
//loggers::get_instance().log(">>> btp_codec::decode_: processing %s/%s (%d,%d,%p)", type.get_descriptor()->name, field_descriptor.name, decoding_buffer.get_len(), decoding_buffer.get_pos(), decoding_buffer.get_read_data());
if (dynamic_cast<Record_Type *>(&type) != NULL) {
Record_Type& r = (Record_Type &)type;
loggers::get_instance().log("btp_codec::decode_: processing Record_Type %s", r.get_descriptor()->name);
//loggers::get_instance().log("btp_codec::decode_: processing Record_Type %s", r.get_descriptor()->name);
for(int i = 0; i < r.get_count(); i++) {
loggers::get_instance().log("btp_codec::decode_: processing %s/%s/%s", r.fld_name(i), r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name);
//loggers::get_instance().log("btp_codec::decode_: processing %s/%s/%s", r.fld_name(i), r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name);
if (decode_(*dynamic_cast<Base_Type *>(r.get_at(i)), *(r.fld_descr(i)), decoding_buffer) == -1) {
return -1;
}
} // End of 'for' statement
} else {
loggers::get_instance().log("btp_codec::decode_ (else): processing type %s/%s - optional:%d", type.get_descriptor()->name, field_descriptor.name, type.is_optional());
//loggers::get_instance().log("btp_codec::decode_ (else): processing type %s/%s - optional:%d", type.get_descriptor()->name, field_descriptor.name, type.is_optional());
if (std::string(field_descriptor.name).compare("@LibItsBtp_TypesAndValues.BtpPacket.header") == 0) {
loggers::get_instance().log("btp_codec::decode_: _type = %d", _type);
//loggers::get_instance().log("btp_codec::decode_: _type = %d", _type);
LibItsBtp__TypesAndValues::BtpHeader& b = static_cast<LibItsBtp__TypesAndValues::BtpHeader&>(type);
if (_type == btp_codec::btpA) {
decode_(b.btpAHeader(), *b.btpAHeader().get_descriptor(), decoding_buffer);
......@@ -102,25 +102,25 @@ int btp_codec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_desc
(*_params)[params::btp_info] = std::to_string(static_cast<int>(b.btpBHeader().destinationPortInfo()));
}
} else {
loggers::get_instance().error("btp_codec::decode_: Invalid BTP type"); // Cannot be reached
//loggers::get_instance().error("btp_codec::decode_: Invalid BTP type"); // Cannot be reached
}
loggers::get_instance().log_msg("btp_codec::decode_: BtpHeader: ", type);
//loggers::get_instance().log_msg("btp_codec::decode_: BtpHeader: ", type);
} else if (std::string(field_descriptor.name).compare("@LibItsBtp_TypesAndValues.BtpPacket.payload") == 0) {
if (decoding_buffer.get_len() == decoding_buffer.get_pos()) { // No payload, set it to omit
loggers::get_instance().log("btp_codec::decode_: Set OPTIONAL<BtpRawPayload> to omit");
//loggers::get_instance().log("btp_codec::decode_: Set OPTIONAL<BtpRawPayload> to omit");
dynamic_cast<OPTIONAL<LibItsBtp__TypesAndValues::BtpRawPayload> &>(type).set_to_omit();
} else {
// Decode BtpRawPayload data structure
OCTETSTRING os(decoding_buffer.get_len() - decoding_buffer.get_pos(), decoding_buffer.get_data() + decoding_buffer.get_pos());
loggers::get_instance().log_msg("btp_codec::decode_: s=", os);
//loggers::get_instance().log_msg("btp_codec::decode_: s=", os);
if (_params != NULL) {
(*_params)[params::btp_payload] = std::string(static_cast<const char *>(oct2str(os)));
}
if (os.lengthof() != 0) {
dynamic_cast<OPTIONAL<LibItsBtp__TypesAndValues::BtpRawPayload> &>(type) = OPTIONAL<LibItsBtp__TypesAndValues::BtpRawPayload>(os);
loggers::get_instance().log_msg("btp_codec::decode_: Set OPTIONAL to ", type);
//loggers::get_instance().log_msg("btp_codec::decode_: Set OPTIONAL to ", type);
} else {
loggers::get_instance().log("btp_codec::decode_: Set OPTIONAL to omit");
//loggers::get_instance().log("btp_codec::decode_: Set OPTIONAL to omit");
dynamic_cast<OPTIONAL<LibItsBtp__TypesAndValues::BtpRawPayload> &>(type).set_to_omit();
}
}
......@@ -129,8 +129,8 @@ int btp_codec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_desc
}
}
loggers::get_instance().log_msg("<<< btp_codec::decode_: ", type);
loggers::get_instance().log_to_hexa("<<< btp_codec::decode_: decoding_buffer=", decoding_buffer);
//loggers::get_instance().log_msg("<<< btp_codec::decode_: ", type);
//loggers::get_instance().log_to_hexa("<<< btp_codec::decode_: decoding_buffer=", decoding_buffer);
return 0;
}
......
......@@ -62,36 +62,37 @@ int geonetworking_codec::encode (const LibItsGeoNetworking__TypesAndValues::GnNo
int geonetworking_codec::encode_ (const Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& encoding_buffer)
{
loggers::get_instance().log(">>> geonetworking_codec::encode_: processing %s/%s", type.get_descriptor()->name, field_descriptor.name);
loggers::get_instance().log_msg(">>> geonetworking_codec::encode_: ", type);
//loggers::get_instance().log(">>> geonetworking_codec::encode_: processing %s/%s", type.get_descriptor()->name, field_descriptor.name);
//loggers::get_instance().log_msg(">>> geonetworking_codec::encode_: ", type);
if (dynamic_cast<const Record_Type *>(&type) != NULL) {
const Record_Type& r = (const Record_Type &)type;
loggers::get_instance().log("geonetworking_codec::encode_: processing Record_Type %s", r.get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_: processing Record_Type %s", r.get_descriptor()->name);
for(int i = 0; i < r.get_count(); i++) {
loggers::get_instance().log("geonetworking_codec::encode_: processing %s/%s/%s - %d (1 ==> use dynamic_cast<const OPTIONAL<...>) - %d", r.fld_name(i), r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name, r.get_at(i)->is_optional(), r.get_at(i)->is_present());
//loggers::get_instance().log("geonetworking_codec::encode_: processing %s/%s/%s - %d (1 ==> use dynamic_cast<const OPTIONAL<...>) - %d", r.fld_name(i), r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name, r.get_at(i)->is_optional(), r.get_at(i)->is_present());
if (r.get_at(i)->is_present()) {
if ((_ec.get_basic_header() == 0x02) && (std::string(r.fld_descr(i)->name).compare("@LibItsGeoNetworking_TypesAndValues.GeoNetworkingPacket.packet") == 0)) { // Encoding secured GeoNetworking packet, unsecured GN message was already encoded using encvalue
loggers::get_instance().log("geonetworking_codec::encode_: Skip it");
//loggers::get_instance().log("geonetworking_codec::encode_: Skip it");
continue;
}
if (encode_(*r.get_at(i), *r.fld_descr(i), encoding_buffer) == -1) {
loggers::get_instance().warning("geonetworking_codec::encode_: -1 result code returned");
//loggers::get_instance().warning("geonetworking_codec::encode_: -1 result code returned");
return -1;
}
}
} // End of 'for' statement
} else if (std::string(type.get_descriptor()->name).compare("@LibItsGeoNetworking_TypesAndValues.ExtendedHeader") == 0) {
const OPTIONAL<LibItsGeoNetworking__TypesAndValues::ExtendedHeader> &v = dynamic_cast<const OPTIONAL<LibItsGeoNetworking__TypesAndValues::ExtendedHeader> &>(type);
loggers::get_instance().log("geonetworking_codec::encode_: ExtendedHeader present: %d", v.is_present());
//loggers::get_instance().log("geonetworking_codec::encode_: ExtendedHeader present: %d", v.is_present());
if (v.is_present()) {
if (encode_extendedHeader(static_cast<const LibItsGeoNetworking__TypesAndValues::ExtendedHeader &>(*v.get_opt_value()), encoding_buffer) == -1) {
loggers::get_instance().warning("geonetworking_codec::encode_: -1 result code returned");
return -1;
}
}
} else if (std::string(field_descriptor.name).compare("@LibItsGeoNetworking_TypesAndValues.GnNonSecuredPacket.payload") == 0) {
const OPTIONAL<LibItsGeoNetworking__TypesAndValues::GnRawPayload> &v = dynamic_cast<const OPTIONAL<LibItsGeoNetworking__TypesAndValues::GnRawPayload> &>(type);
loggers::get_instance().log("geonetworking_codec::encode_: GnRawPayload present: %d", v.is_present());
//loggers::get_instance().log("geonetworking_codec::encode_: GnRawPayload present: %d", v.is_present());
if (v.is_present()) {
const LibItsGeoNetworking__TypesAndValues::GnRawPayload& p = static_cast<const LibItsGeoNetworking__TypesAndValues::GnRawPayload &>(*v.get_opt_value());
if (encode_(p, *p.get_descriptor()/*LibItsGeoNetworking__TypesAndValues::GnRawPayload_descr_*/, encoding_buffer) == -1) {
......@@ -100,11 +101,11 @@ int geonetworking_codec::encode_ (const Base_Type& type, const TTCN_Typedescript
}
// Store playload length and continue encoding
_ec.set_length(p.lengthof());
loggers::get_instance().log("geonetworking_codec::encode_: Storing payload length %d for %s", _ec.get_length(), p.get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_: Storing payload length %d for %s", _ec.get_length(), p.get_descriptor()->name);
}
} else if (std::string(field_descriptor.name).compare("@EtsiTs103097Module.EtsiTs103097Data") == 0) {
const EtsiTs103097Module::EtsiTs103097Data& ieee_1609dot2_data = static_cast<const EtsiTs103097Module::EtsiTs103097Data&>(type);
loggers::get_instance().log_msg("geonetworking_codec::encode_: Encode secured message= ", ieee_1609dot2_data);
//loggers::get_instance().log_msg("geonetworking_codec::encode_: Encode secured message= ", ieee_1609dot2_data);
etsi_ts103097_data_codec codec;
OCTETSTRING os;
codec.encode(ieee_1609dot2_data, os);
......@@ -112,31 +113,31 @@ int geonetworking_codec::encode_ (const Base_Type& type, const TTCN_Typedescript
loggers::get_instance().warning("geonetworking_codec::encode_: Failed to encode EtsiTs103097Data");
return -1;
}
loggers::get_instance().log_msg("geonetworking_codec::encode_: ", os);
//loggers::get_instance().log_msg("geonetworking_codec::encode_: ", os);
encoding_buffer.put_string(os);
} else {
loggers::get_instance().log("geonetworking_codec::encode_ (else): processing type %s/%s", type.get_descriptor()->name, field_descriptor.name);
//loggers::get_instance().log("geonetworking_codec::encode_ (else): processing type %s/%s", type.get_descriptor()->name, field_descriptor.name);
if (std::string(field_descriptor.name).compare("@LibItsGeoNetworking_TypesAndValues.BasicHeader.nextHeader") == 0) {
// Store NextHeader field value and continue encoding
_ec.set_basic_header((unsigned int)dynamic_cast<const Enum_Type &>(type).as_int());
loggers::get_instance().log("geonetworking_codec::encode_: Storing basic_header %d for %s", _ec.get_next_header(), field_descriptor.name);
//loggers::get_instance().log("geonetworking_codec::encode_: Storing basic_header %d for %s", _ec.get_next_header(), field_descriptor.name);
} else if (std::string(field_descriptor.name).compare("@LibItsGeoNetworking_TypesAndValues.CommonHeader.nextHeader") == 0) {
// Store NextHeader field value and continue encoding
_ec.set_next_header((unsigned int)dynamic_cast<const Enum_Type &>(type).as_int());
loggers::get_instance().log("geonetworking_codec::encode_: Storing next_header %d for %s", _ec.get_next_header(), field_descriptor.name);
//loggers::get_instance().log("geonetworking_codec::encode_: Storing next_header %d for %s", _ec.get_next_header(), field_descriptor.name);
} else if (std::string(field_descriptor.name).compare("@LibItsGeoNetworking_TypesAndValues.CommonHeader.headerType") == 0) {
// Store HeaderType field value and continue encoding
_ec.set_header_type((unsigned int)dynamic_cast<const Enum_Type &>(type).as_int());
loggers::get_instance().log("geonetworking_codec::encode_: Storing header_type %d for %s", _ec.get_header_type(), field_descriptor.name);
//loggers::get_instance().log("geonetworking_codec::encode_: Storing header_type %d for %s", _ec.get_header_type(), field_descriptor.name);
} else if (std::string(field_descriptor.name).compare("@LibItsGeoNetworking_TypesAndValues.CommonHeader.plLength") == 0) {
// Store TTCN_Buffer position and continue encoding
_ec.set_length_position(encoding_buffer.get_len());
loggers::get_instance().log("geonetworking_codec::encode_: Storing position %d for %s", _ec.get_length_position(), field_descriptor.name);
//loggers::get_instance().log("geonetworking_codec::encode_: Storing position %d for %s", _ec.get_length_position(), field_descriptor.name);
}
type.encode(field_descriptor, encoding_buffer, TTCN_EncDec::CT_RAW);
}
loggers::get_instance().log_to_hexa("<<< geonetworking_codec::encode_: ", encoding_buffer);
//loggers::get_instance().log_to_hexa("<<< geonetworking_codec::encode_: ", encoding_buffer);
return 0;
}
......@@ -168,14 +169,15 @@ int geonetworking_codec::decode (const OCTETSTRING& data, LibItsGeoNetworking__T
int geonetworking_codec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& decoding_buffer)
{
loggers::get_instance().log(">>> geonetworking_codec::decode_: processing %s/%s (%d,%d,%p)", type.get_descriptor()->name, field_descriptor.name, decoding_buffer.get_len(), decoding_buffer.get_pos(), decoding_buffer.get_read_data());
//loggers::get_instance().log(">>> geonetworking_codec::decode_: processing %s/%s (%d,%d,%p)", type.get_descriptor()->name, field_descriptor.name, decoding_buffer.get_len(), decoding_buffer.get_pos(), decoding_buffer.get_read_data());
if (dynamic_cast<Record_Type *>(&type) != NULL) {
Record_Type& r = (Record_Type &)type;
loggers::get_instance().log("geonetworking_codec::decode_: processing Record_Type %s", r.get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::decode_: processing Record_Type %s", r.get_descriptor()->name);
for(int i = 0; i < r.get_count(); i++) {
loggers::get_instance().log("geonetworking_codec::decode_: processing %s/%s/%s", r.fld_name(i), r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::decode_: processing %s/%s/%s", r.fld_name(i), r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name);
if (decode_(*dynamic_cast<Base_Type *>(r.get_at(i)), *(r.fld_descr(i)), decoding_buffer) == -1) {
loggers::get_instance().warning("geonetworking_codec::decode_: -1 result code returned");
return -1;
}
} // End of 'for' statement
......@@ -206,7 +208,7 @@ int geonetworking_codec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t&
} else if (std::string(type.get_descriptor()->name).compare("@IEEE1609dot2.Ieee1609Dot2Data") == 0) {
dynamic_cast<OPTIONAL<IEEE1609dot2::Ieee1609Dot2Data> &>(type).set_to_omit(); // TODO Add security support
} else {
loggers::get_instance().log("geonetworking_codec::decode_ (else): processing type %s/%s - optional:%d", type.get_descriptor()->name, field_descriptor.name, type.is_optional());
//loggers::get_instance().log("geonetworking_codec::decode_ (else): processing type %s/%s - optional:%d", type.get_descriptor()->name, field_descriptor.name, type.is_optional());
if (std::string(field_descriptor.name).compare("@LibItsGeoNetworking_TypesAndValues.CommonHeader.nextHeader") == 0) {
// Decode NextHeader data structure
type.decode(field_descriptor, decoding_buffer, TTCN_EncDec::CT_RAW);
......@@ -220,22 +222,22 @@ int geonetworking_codec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t&
decode_extendedHeader(e, decoding_buffer);
if (e.is_bound()) {
dynamic_cast<OPTIONAL<LibItsGeoNetworking__TypesAndValues::ExtendedHeader> &>(type) = OPTIONAL<LibItsGeoNetworking__TypesAndValues::ExtendedHeader>(e);
loggers::get_instance().log_msg("geonetworking_codec::decode_: Set OPTIONAL to ", type);
//loggers::get_instance().log_msg("geonetworking_codec::decode_: Set OPTIONAL to ", type);
} else {
loggers::get_instance().log("geonetworking_codec::decode_: Set OPTIONAL to omit");
//loggers::get_instance().log("geonetworking_codec::decode_: Set OPTIONAL to omit");
dynamic_cast<OPTIONAL<LibItsGeoNetworking__TypesAndValues::ExtendedHeader> &>(type).set_to_omit();
}
} else if (std::string(field_descriptor.name).compare("@LibItsGeoNetworking_TypesAndValues.GnNonSecuredPacket.payload") == 0) {
// Decode raw payload data structure
OCTETSTRING s(decoding_buffer.get_len() - decoding_buffer.get_pos(), decoding_buffer.get_data() + decoding_buffer.get_pos());
loggers::get_instance().log_msg("geonetworking_codec::decode_: s=", s);
//loggers::get_instance().log_msg("geonetworking_codec::decode_: s=", s);
const unsigned char * p = static_cast<const unsigned char *>(s);
if (p == NULL) {
loggers::get_instance().warning("geonetworking_codec::encode_: Static cast error");
return -1;
}
// Align the payload length with the specified plLenght value
loggers::get_instance().log("geonetworking_codec::decode_: Payload: Decoded payload length: %d", _dc.get_length());
//loggers::get_instance().log("geonetworking_codec::decode_: Payload: Decoded payload length: %d", _dc.get_length());
OCTETSTRING os;
if (_dc.get_length() != 0) {
if ((unsigned char)s.lengthof() <= _dc.get_length()) {
......@@ -249,13 +251,13 @@ int geonetworking_codec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t&
os = OCTETSTRING(0, nullptr);
(*_params)[params::gn_payload] = "";
}
loggers::get_instance().log_msg("geonetworking_codec::decode_: Payload: os: ", os);
loggers::get_instance().log("geonetworking_codec::decode_: Payload: '%s'", (*_params)[params::gn_payload].c_str());
//loggers::get_instance().log_msg("geonetworking_codec::decode_: Payload: os: ", os);
//loggers::get_instance().log("geonetworking_codec::decode_: Payload: '%s'", (*_params)[params::gn_payload].c_str());
if (os.lengthof() != 0) {
dynamic_cast<OPTIONAL<LibItsGeoNetworking__TypesAndValues::GnRawPayload> &>(type) = OPTIONAL<LibItsGeoNetworking__TypesAndValues::GnRawPayload>(os);
loggers::get_instance().log_msg("geonetworking_codec::decode_: Set OPTIONAL<GnRawPayload> to ", type);
//loggers::get_instance().log_msg("geonetworking_codec::decode_: Set OPTIONAL<GnRawPayload> to ", type);
} else {
loggers::get_instance().log("geonetworking_codec::decode_: Set OPTIONAL<GnRawPayload> to omit");
//loggers::get_instance().log("geonetworking_codec::decode_: Set OPTIONAL<GnRawPayload> to omit");
dynamic_cast<OPTIONAL<LibItsGeoNetworking__TypesAndValues::GnRawPayload> &>(type).set_to_omit();
}
} else if (std::string(field_descriptor.name).compare("@LibItsGeoNetworking_TypesAndValues.CommonHeader.plLength") == 0) {
......@@ -268,14 +270,14 @@ int geonetworking_codec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t&
}
}
loggers::get_instance().log_msg("<<< geonetworking_codec::decode_: ", type);
loggers::get_instance().log_to_hexa("<<< geonetworking_codec::decode_: decoding_buffer=", decoding_buffer);
//loggers::get_instance().log_msg("<<< geonetworking_codec::decode_: ", type);
//loggers::get_instance().log_to_hexa("<<< geonetworking_codec::decode_: decoding_buffer=", decoding_buffer);
return 0;
}
int geonetworking_codec::encode_extendedHeader(const LibItsGeoNetworking__TypesAndValues::ExtendedHeader& u, TTCN_Buffer& encoding_buffer) {
loggers::get_instance().log(">>> geonetworking_codec::encode_extendedHeader: processing %s", u.get_descriptor()->name);
//loggers::get_instance().log(">>> geonetworking_codec::encode_extendedHeader: processing %s", u.get_descriptor()->name);
int result = -1;
switch (u.get_selection()) {
......@@ -283,39 +285,39 @@ int geonetworking_codec::encode_extendedHeader(const LibItsGeoNetworking__TypesA
TTCN_error("geonetworking_codec::encode_extendedHeader: Invalid selection in unbound union");
break;
case LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_geoUnicastHeader:
loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.geoUnicastHeader().get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.geoUnicastHeader().get_descriptor()->name);
result = encode_(u.geoUnicastHeader(), *u.geoUnicastHeader().get_descriptor(), encoding_buffer);
break;
case LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_tsbHeader:
loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.tsbHeader().get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.tsbHeader().get_descriptor()->name);
result = encode_(u.tsbHeader(), *u.tsbHeader().get_descriptor(), encoding_buffer);
break;
case LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_shbHeader:
loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.shbHeader().get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.shbHeader().get_descriptor()->name);
result = encode_(u.shbHeader(), *u.shbHeader().get_descriptor(), encoding_buffer);
break;
case LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_geoBroadcastHeader:
loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.geoBroadcastHeader().get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.geoBroadcastHeader().get_descriptor()->name);
result = encode_(u.geoBroadcastHeader(), *u.geoBroadcastHeader().get_descriptor(), encoding_buffer);
break;
case LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_geoAnycastHeader:
loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.geoAnycastHeader().get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.geoAnycastHeader().get_descriptor()->name);
result = encode_(u.geoAnycastHeader(), *u.geoAnycastHeader().get_descriptor(), encoding_buffer);
break;
case LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_beaconHeader:
loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.beaconHeader().get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.beaconHeader().get_descriptor()->name);
result = encode_(u.beaconHeader(), *u.beaconHeader().get_descriptor(), encoding_buffer);
break;
case LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_anyHeader:
loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.anyHeader().get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.anyHeader().get_descriptor()->name);
result = encode_(u.anyHeader(), *u.anyHeader().get_descriptor(), encoding_buffer);
break;
case LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_lsRequestHeader:
loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.lsRequestHeader().get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.lsRequestHeader().get_descriptor()->name);
result = encode_(u.lsRequestHeader(), *u.lsRequestHeader().get_descriptor(), encoding_buffer);
break;
case LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_lsReplyHeader:
loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.lsReplyHeader().get_descriptor()->name);
//loggers::get_instance().log("geonetworking_codec::encode_extendedHeader: processing type %s", u.lsReplyHeader().get_descriptor()->name);
result = encode_(u.lsReplyHeader(), *u.lsReplyHeader().get_descriptor(), encoding_buffer);
break;
default: TTCN_error("geonetworking_codec::encode_extendedHeader: Invalid selection in union is_bound");
......@@ -325,12 +327,12 @@ int geonetworking_codec::encode_extendedHeader(const LibItsGeoNetworking__TypesA
}
int geonetworking_codec::decode_headerTST(LibItsGeoNetworking__TypesAndValues::HeaderTST& u, TTCN_Buffer& decoding_buffer) {
loggers::get_instance().log(">>> geonetworking_codec::decode_headerTST: processing %s", u.get_descriptor()->name);
//loggers::get_instance().log(">>> geonetworking_codec::decode_headerTST: processing %s", u.get_descriptor()->name);
// Decode HeaderTST data structure
_dc.set_header_type(*(decoding_buffer.get_data() + decoding_buffer.get_pos()) >> 4);
_dc.set_header_sub_type(*(decoding_buffer.get_data() + decoding_buffer.get_pos()) & 0x0F);
loggers::get_instance().log("geonetworking_codec::decode_: headerTST selectors: _dc.header_type = %d - _dc.header_sub_type = %d", _dc.get_header_type(), _dc.get_header_sub_type());
//loggers::get_instance().log("geonetworking_codec::decode_: headerTST selectors: _dc.header_type = %d - _dc.header_sub_type = %d", _dc.get_header_type(), _dc.get_header_sub_type());
//LibItsGeoNetworking__TypesAndValues::HeaderTST & u = dynamic_cast<LibItsGeoNetworking__TypesAndValues::HeaderTST &>(u);
switch (_dc.get_header_type()) {
case LibItsGeoNetworking__TypesAndValues::HeaderType::e__geoUnicast:
......@@ -362,7 +364,7 @@ int geonetworking_codec::decode_headerTST(LibItsGeoNetworking__TypesAndValues::H
}
int geonetworking_codec::decode_extendedHeader(LibItsGeoNetworking__TypesAndValues::ExtendedHeader& u, TTCN_Buffer& decoding_buffer) {
loggers::get_instance().log(">>> geonetworking_codec::decode_extendedHeader: processing %s", u.get_descriptor()->name);
//loggers::get_instance().log(">>> geonetworking_codec::decode_extendedHeader: processing %s", u.get_descriptor()->name);
switch (_dc.get_header_type()) {
case LibItsGeoNetworking__TypesAndValues::HeaderType::e__geoUnicast:
......
......@@ -1107,14 +1107,14 @@ int geonetworking_layer::build_secured_pdu(OCTETSTRING& data, params& params) {
}
int geonetworking_layer::decode_basic_header(const OCTETSTRING& p_data, LibItsGeoNetworking__TypesAndValues::BasicHeader& p_basic_header) {
loggers::get_instance().log_msg(">>> geonetworking_layer::decode_basic_header: ", p_data);
//loggers::get_instance().log_msg(">>> geonetworking_layer::decode_basic_header: ", p_data);
// Update security mode
OCTETSTRING bh = OCTETSTRING(4, static_cast<const unsigned char*>(p_data)); // Extract the basic header as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) Clause 9.6
loggers::get_instance().log_msg("geonetworking_layer::decode_basic_header: bh: ", bh);
//loggers::get_instance().log_msg("geonetworking_layer::decode_basic_header: bh: ", bh);
TTCN_Buffer decoding_buffer(bh);
p_basic_header.RAW_decode(*p_basic_header.get_descriptor(), decoding_buffer, decoding_buffer.get_len() * 8, raw_order_t::ORDER_MSB);
loggers::get_instance().log_msg("geonetworking_layer::decode_basic_header: ", p_basic_header);
//loggers::get_instance().log_msg("geonetworking_layer::decode_basic_header: ", p_basic_header);
return 0;
}
......
......@@ -187,7 +187,38 @@ system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_
# For each vehicular manoeuvre at a signalized intersection, an IUT shall include the current movement state
#ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_06
# For each pedestrian manoeuvre at a signalized intersection, an IUT shall include the current movement state
ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_07
#ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_07
# For each active manoeuvre an IUT shall include the earliest time point when the manoeuvre state is predicted to change
#ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_08
# For each manoeuvre at a signalized intersection, an IUT shall include:
# - the next expected movement states pertaining to that manoeuvre
# - the time point for when the succeeding manoeuvre state is predicted to change
# - the start time for each pending manoeuvre
#ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_09
# Check that SPAT message prioritization is encoded using regional extension
#Not Supported yet ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_10
# For each manoeuvre at a signalized intersection, an IUT shall indicate if one or more pedestrians have been detected in the pedestrian crossing
#ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_11
# An IUT shall transmit information about the optimal speed for vehicles on each lane
#ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_12
# An IUT shall transmit information about the signal timing progression speed along the roadway
#ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_13
# An IUT shall transmit the length of the queue and the length of available vehicular storage on each egress lane
#ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_14
# Check that TLM Service generates a new SPATEM on reception of a valid AppSPATEM _Start request
#ItsSpatem_TestCases.TC_IS_TLM_GEN_EVGN_BV_01
# Check that TLM Service generates SPATEM are time ordered
#ItsSpatem_TestCases.TC_IS_TLM_GEN_EVGN_BV_02
# Check that TLM Service terminates on reception of a valid AppSPATEM _Stop request
#ItsSpatem_TestCases.TC_IS_TLM_GEN_EVGN_BV_03
# Check that TLM Service generates a new SPATEM on reception of a valid AppSPATEM_Trigger request
#ItsSpatem_TestCases.TC_IS_TLM_GEN_EVGN_BV_04
# Check that TLM Service provides the destination area in SPATEM
#ItsSpatem_TestCases.TC_IS_TLM_GEN_COM_BV_01
# Check that SPATEM uses BTP_B packet. Check that the destination port for SPATEM is set to 2004
#ItsSpatem_TestCases.TC_IS_TLM_GEN_COM_BV_02
# Check that TLM service encapsulates SPATEM in a GBC with the HeaderType field set to the value of 4
ItsSpatem_TestCases.TC_IS_TLM_GEN_COM_BV_03
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
......
......@@ -27,7 +27,7 @@ ItsRSUsSimulator_Pixits.PX_RSU_ID := 1;
# UC7 (CAM only): PX_ETSI_USE_CASE_ID := 7
# UC8 (EVCSN only): PX_ETSI_USE_CASE_ID := 8
# UC9 (CAM only): PX_ETSI_USE_CASE_ID := 9
ItsRSUsSimulator_Pixits.PX_ETSI_USE_CASE_ID := 5 # 7 PX_RSU_ID := 8 ==> LCWW
ItsRSUsSimulator_Pixits.PX_ETSI_USE_CASE_ID := 3 # 7 PX_RSU_ID := 8 ==> LCWW
# 1 PX_RSU_ID := 1 ==> RWW
# 2 PX_RSU_ID := 1 ==> RHW
# Indicate which zone to simulate
......@@ -38,7 +38,7 @@ ItsRSUsSimulator_Pixits.PX_DENM_PARAM_UC2 := 1; # ==> RHW (1..5)
ItsRSUsSimulator_Pics.PICS_GENERATE_BEACON := false # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_CAM := false # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_DENM := false # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_IVIM := true # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_IVIM := false # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_MAPEM := false # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_SPATEM := false # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_SREM := false # Change also its_aid in geoNetworking port setting
......@@ -54,7 +54,7 @@ ItsRSUsSimulator_Pics.PICS_DENM_FREQUENCY := 1.0
ItsRSUsSimulator_Pics.PICS_SEND_BEACON_INDICATION := false
ItsRSUsSimulator_Pics.PICS_SEND_CAM_INDICATION := true
ItsRSUsSimulator_Pics.PICS_SEND_DENM_INDICATION := false
ItsRSUsSimulator_Pics.PICS_SEND_DENM_INDICATION := true
ItsRSUsSimulator_Pics.PICS_SEND_IVIM_INDICATION := true
ItsRSUsSimulator_Pics.PICS_SEND_MAPEM_INDICATION := true
ItsRSUsSimulator_Pics.PICS_SEND_SPATEM_INDICATION := true
......@@ -182,7 +182,7 @@ LogEventTypes:= Yes
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=36,secured_mode=0,certificate=CERT_IUT_A_AT,sec_db_path=/home/yann/tmp/asn1c_cert)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)"
# Linux
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=/home/yann/tmp/asn1c_cert)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=eno1,filter=and ether proto 0x8947)"
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=139,secured_mode=0,certificate=CERT_IUT_A_AT,sec_db_path=/home/yann/tmp/asn1c_cert)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp2s0,filter=and ether proto 0x8947)"
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=138,secured_mode=0,certificate=CERT_IUT_A_AT,sec_db_path=/home/yann/tmp/asn1c_cert)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp2s0,filter=and ether proto 0x8947)"
# Commsignia
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=37,secured_mode=0,encrypted_mode=0,certificate=CERT_IUT_A_AT,peer_certificate=CERT_TS_A_AT,sec_db_path=/home/yann/tmp/asn1c_cert)/COMMSIGNIA(xport_mode=LTE-V2X,mac_src=080027F44E7D,interface_id=2,target_host=192.168.0.54)/UDP(dst_ip=192.168.0.54,src_port=9091,dst_port=7946)"
# Qualcom
......@@ -195,8 +195,8 @@ system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050
# Config port based on UDP
#system.cfPort.params := "CF(ut=cam)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)"
#system.cfPort.params := "CF(ut=denm)/UDP(src_port=12345,reuse_incoming_source_adddress=1)"
system.cfPort.params := "CF(ut=ivim)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)"
#system.cfPort.params := "CF(ut=mapemspatem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)"
#system.cfPort.params := "CF(ut=ivim)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)"
system.cfPort.params := "CF(ut=mapemspatem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)"
#system.cfPort.params := "CF(ut=sremssem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)"
#system.cfPort.params := "CF(ut=rtcmem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)"
#system.cfPort.params := "CF(ut=gn)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)"
......
......@@ -99,7 +99,7 @@ module ItsMapemSpatem_TestControl {
if (PICS_SPATEM_PRIORITIZATION ) {
execute(TC_IS_TLM_GEN_MSGF_BV_10 ());
}
if (PICS_SPATEM_PEDESTRIAN_MAOEUVRES ) {
if (PICS_SPATEM_PEDESTRIAN_MANOEUVRES ) {
execute(TC_IS_TLM_GEN_MSGF_BV_11 ());
}
if (PICS_SPATEM_HAS_OPTIMAL_SPEED ) {
......
......@@ -724,7 +724,8 @@ module ItsSpatem_TestCases {
* containing elements of type ConnectionManeuverAssist
* containing queueLength
* indicating current length of the queue
* and containing availableStorageLength
* and containing availableStorageLength
* indicating available space for the line queue
* }
* }
......@@ -846,10 +847,10 @@ module ItsSpatem_TestCases {
* Expected behaviour:
* ensure that {
* when {
* the IUT receives an AppSPATEM _Stop request from the application layer
* the IUT receives an AppSPATEM _Trigger request from the application layer
* }
* then {
* the IUT stops sending SPATEM
* the IUT sends a valid SPATEM
* }
* }
* </pre>
......
......@@ -81,7 +81,7 @@ module ItsSpatem_TpFunctions {
}
// Postamble
//f_utTriggerEvent(m_utTriggerEvent(stopTLMService));
f_utTriggerEvent(m_utTriggerEvent(stopTLMService));
f_poDefault();
f_cfDown();
......@@ -138,7 +138,7 @@ module ItsSpatem_TpFunctions {
}
// Postamble
//f_utTriggerEvent(m_utTriggerEvent(stopTLMService));
f_utTriggerEvent(m_utTriggerEvent(stopTLMService));
f_poDefault();
f_cfDown();
......@@ -195,7 +195,7 @@ module ItsSpatem_TpFunctions {
}
// Postamble
//f_utTriggerEvent(m_utTriggerEvent(stopTLMService));
f_utTriggerEvent(m_utTriggerEvent(stopTLMService));
f_poDefault();
f_cfDown();
......@@ -247,7 +247,7 @@ module ItsSpatem_TpFunctions {
}
// Postamble
//f_utTriggerEvent(m_utTriggerEvent(stopTLMService));
f_utTriggerEvent(m_utTriggerEvent(stopTLMService));
f_poDefault();
f_cfDown();
......@@ -304,7 +304,7 @@ module ItsSpatem_TpFunctions {
}