Loading ccsrc/EncDec/LibItsCam_Encdec.cc +94 −4 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ namespace LibItsCam__EncdecDeclarations { INTEGER fx__dec__CamInd(BITSTRING& b, LibItsCam__TestSystem::CamInd& p_camInd) { loggers::get_instance().log_msg(">>> fx__enc__CamInd: ", p_camInd); loggers::get_instance().log(">>> fx__dec__CamInd"); CAMCodec codec; CAM__PDU__Descriptions::CAM cam; Loading @@ -66,15 +66,105 @@ namespace LibItsCam__EncdecDeclarations { LibItsCam__TestSystem::CamInd_ssp_raw_.fieldlength + LibItsCam__TestSystem::CamInd_its__aid_raw_.fieldlength ) / 8; // Decode CA message if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is)), cam) == -1) { loggers::get_instance().warning("fx__dec__CamInd: -1 result code was returned"); return -1; } p_camInd.msgIn() = cam; // Decode lower layer data TTCN_Buffer decoding_buffer(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is) + is.lengthof() - s)); for (int i = 1; i < p_camInd.get_count(); i++) { p_camInd.get_at(i)->decode(*p_camInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); } // End of 'for' statement loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnNextHeader_raw_.fieldlength / 8)) { p_camInd.gnNextHeader().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsCam__TestSystem::CamInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnNextHeader() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnNextHeader()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnHeaderType_raw_.fieldlength / 8)) { p_camInd.gnHeaderType().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsCam__TestSystem::CamInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnHeaderType() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnHeaderType()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_camInd.gnHeaderSubtype().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsCam__TestSystem::CamInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnHeaderSubtype() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnHeaderSubtype()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnLifetime_raw_.fieldlength / 8)) { p_camInd.gnLifetime().set_to_omit(); } else { INTEGER i; i.decode(LibItsCam__TestSystem::CamInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnLifetime() = i; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnLifetime()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnTrafficClass_raw_.fieldlength / 8)) { p_camInd.gnTrafficClass().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsCam__TestSystem::CamInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnTrafficClass() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnTrafficClass()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_btpDestinationPort_raw_.fieldlength / 8)) { p_camInd.btpDestinationPort().set_to_omit(); } else { INTEGER i; i.decode(LibItsCam__TestSystem::CamInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.btpDestinationPort() = i; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.btpDestinationPort()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_btpInfo_raw_.fieldlength / 8)) { p_camInd.btpInfo().set_to_omit(); } else { INTEGER i; i.decode(LibItsCam__TestSystem::CamInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.btpInfo() = i; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.btpInfo()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_ssp_raw_.fieldlength / 8)) { p_camInd.ssp().set_to_omit(); } else { BITSTRING bs; bs.decode(LibItsCam__TestSystem::CamInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.ssp() = bs; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.ssp()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_its__aid_raw_.fieldlength / 8)) { p_camInd.its__aid().set_to_omit(); } else { INTEGER i; i.decode(LibItsCam__TestSystem::CamInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.its__aid() = i; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.its__aid()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); return 0; } Loading ccsrc/EncDec/LibItsDenm_Encdec.cc +104 −5 Original line number Diff line number Diff line Loading @@ -54,17 +54,116 @@ namespace LibItsDenm__EncdecDeclarations { DENM__PDU__Descriptions::DENM denm; OCTETSTRING is = bit2oct(b); // Calculate the size of the lower layers information int s = (LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength) / 8; int s = ( LibItsDenm__TestSystem::DenmInd_gnNextHeader_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_gnHeaderType_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_gnHeaderSubtype_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_gnLifetime_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_gnTrafficClass_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_btpDestinationPort_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_btpInfo_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_ssp_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_its__aid_raw_.fieldlength ) / 8; // Decode DEN message if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is)), denm) == -1) { loggers::get_instance().warning("fx__dec__DenmInd: -1 result code was returned"); return -1; } p_denmInd.msgIn() = denm; // Decode lower layer data TTCN_Buffer decoding_buffer(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is) + is.lengthof() - s)); for (int i = 1; i < p_denmInd.get_count(); i++) { p_denmInd.get_at(i)->decode(*p_denmInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); } // End of 'for' statement loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnNextHeader_raw_.fieldlength / 8)) { p_denmInd.gnNextHeader().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnNextHeader() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnNextHeader()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnHeaderType_raw_.fieldlength / 8)) { p_denmInd.gnHeaderType().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnHeaderType() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnHeaderType()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_denmInd.gnHeaderSubtype().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnHeaderSubtype() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnHeaderSubtype()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnLifetime_raw_.fieldlength / 8)) { p_denmInd.gnLifetime().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnLifetime() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnLifetime()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnTrafficClass_raw_.fieldlength / 8)) { p_denmInd.gnTrafficClass().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnTrafficClass() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnTrafficClass()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_btpDestinationPort_raw_.fieldlength / 8)) { p_denmInd.btpDestinationPort().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.btpDestinationPort() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.btpDestinationPort()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_btpInfo_raw_.fieldlength / 8)) { p_denmInd.btpInfo().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.btpInfo() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.btpInfo()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_ssp_raw_.fieldlength / 8)) { p_denmInd.ssp().set_to_omit(); } else { BITSTRING bs; bs.decode(LibItsDenm__TestSystem::DenmInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.ssp() = bs; } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.ssp()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_its__aid_raw_.fieldlength / 8)) { p_denmInd.its__aid().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.its__aid() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.its__aid()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); return 0; } Loading ccsrc/Framework/src/Params.cc +7 −3 Original line number Diff line number Diff line Loading @@ -53,10 +53,14 @@ void Params::convert(Params& p_param, const std::string p_parameters) { void Params::log() { loggers::get_instance().log("Params::log"); if (size() == 0) { loggers::get_instance().log("\tEmpty"); } else { for (const_iterator it = cbegin(); it != cend(); ++it) { loggers::get_instance().log("\t(%s, %s)", it->first.c_str(), it->second.c_str()); } // End of 'for' statement } } void Params::reset() { loggers::get_instance().log("Params::reset"); Loading ccsrc/Protocols/BTP/BTPCodec.cc +34 −34 Original line number Diff line number Diff line Loading @@ -92,14 +92,14 @@ int BTPCodec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_descr decode_(b.btpAHeader(), *b.btpAHeader().get_descriptor(), decoding_buffer); if (_params != NULL) { (*_params)[Params::btp_type] = std::string("btpA"); (*_params)[Params::btp_destination_port] = static_cast<int>(b.btpAHeader().destinationPort()); (*_params)[Params::btp_destination_port] = std::to_string(static_cast<int>(b.btpAHeader().destinationPort())); } } else if (_type == BTPCodec::btpB) { decode_(b.btpBHeader(), *b.btpBHeader().get_descriptor(), decoding_buffer); if (_params != NULL) { (*_params)[Params::btp_type] = std::string("btpB"); (*_params)[Params::btp_destination_port] = static_cast<int>(b.btpBHeader().destinationPort()); (*_params)[Params::btp_info] = static_cast<int>(b.btpBHeader().destinationPortInfo()); (*_params)[Params::btp_destination_port] = std::to_string(static_cast<int>(b.btpBHeader().destinationPort())); (*_params)[Params::btp_info] = std::to_string(static_cast<int>(b.btpBHeader().destinationPortInfo())); } } else { loggers::get_instance().error("BTPCodec::decode_: Invalid BTP type"); // Cannot be reached Loading ccsrc/Protocols/BTP/BTPCodec.hh +2 −1 Original line number Diff line number Diff line Loading @@ -31,10 +31,11 @@ public: BTPCodec() : Codec<LibItsBtp__TypesAndValues::BtpPacket, LibItsBtp__TypesAndValues::BtpPacket>() { _type = BTPCodec::btpA; loggers::get_instance().log("BTPCodec::BTPCodec(D) :%d ", _type); }; virtual ~BTPCodec() { loggers::get_instance().log("BTPCodec::~BTPCodec"); }; void set_btp_type(const BTPCodec::BtpType p_BtpType); virtual int encode (const LibItsBtp__TypesAndValues::BtpPacket&, OCTETSTRING& data); virtual int decode (const OCTETSTRING& data, LibItsBtp__TypesAndValues::BtpPacket&, Params* params = NULL); inline void set_btp_type(const BTPCodec::BtpType p_btp_type) { _type = p_btp_type; }; private: BtpType _type; }; Loading Loading
ccsrc/EncDec/LibItsCam_Encdec.cc +94 −4 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ namespace LibItsCam__EncdecDeclarations { INTEGER fx__dec__CamInd(BITSTRING& b, LibItsCam__TestSystem::CamInd& p_camInd) { loggers::get_instance().log_msg(">>> fx__enc__CamInd: ", p_camInd); loggers::get_instance().log(">>> fx__dec__CamInd"); CAMCodec codec; CAM__PDU__Descriptions::CAM cam; Loading @@ -66,15 +66,105 @@ namespace LibItsCam__EncdecDeclarations { LibItsCam__TestSystem::CamInd_ssp_raw_.fieldlength + LibItsCam__TestSystem::CamInd_its__aid_raw_.fieldlength ) / 8; // Decode CA message if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is)), cam) == -1) { loggers::get_instance().warning("fx__dec__CamInd: -1 result code was returned"); return -1; } p_camInd.msgIn() = cam; // Decode lower layer data TTCN_Buffer decoding_buffer(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is) + is.lengthof() - s)); for (int i = 1; i < p_camInd.get_count(); i++) { p_camInd.get_at(i)->decode(*p_camInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); } // End of 'for' statement loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnNextHeader_raw_.fieldlength / 8)) { p_camInd.gnNextHeader().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsCam__TestSystem::CamInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnNextHeader() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnNextHeader()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnHeaderType_raw_.fieldlength / 8)) { p_camInd.gnHeaderType().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsCam__TestSystem::CamInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnHeaderType() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnHeaderType()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_camInd.gnHeaderSubtype().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsCam__TestSystem::CamInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnHeaderSubtype() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnHeaderSubtype()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnLifetime_raw_.fieldlength / 8)) { p_camInd.gnLifetime().set_to_omit(); } else { INTEGER i; i.decode(LibItsCam__TestSystem::CamInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnLifetime() = i; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnLifetime()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_gnTrafficClass_raw_.fieldlength / 8)) { p_camInd.gnTrafficClass().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsCam__TestSystem::CamInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnTrafficClass() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.gnTrafficClass()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_btpDestinationPort_raw_.fieldlength / 8)) { p_camInd.btpDestinationPort().set_to_omit(); } else { INTEGER i; i.decode(LibItsCam__TestSystem::CamInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.btpDestinationPort() = i; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.btpDestinationPort()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_btpInfo_raw_.fieldlength / 8)) { p_camInd.btpInfo().set_to_omit(); } else { INTEGER i; i.decode(LibItsCam__TestSystem::CamInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.btpInfo() = i; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.btpInfo()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_ssp_raw_.fieldlength / 8)) { p_camInd.ssp().set_to_omit(); } else { BITSTRING bs; bs.decode(LibItsCam__TestSystem::CamInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.ssp() = bs; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.ssp()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsCam__TestSystem::CamInd_its__aid_raw_.fieldlength / 8)) { p_camInd.its__aid().set_to_omit(); } else { INTEGER i; i.decode(LibItsCam__TestSystem::CamInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.its__aid() = i; } loggers::get_instance().log_msg("fx__dec__CAM: ", p_camInd.its__aid()); loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); return 0; } Loading
ccsrc/EncDec/LibItsDenm_Encdec.cc +104 −5 Original line number Diff line number Diff line Loading @@ -54,17 +54,116 @@ namespace LibItsDenm__EncdecDeclarations { DENM__PDU__Descriptions::DENM denm; OCTETSTRING is = bit2oct(b); // Calculate the size of the lower layers information int s = (LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength) / 8; int s = ( LibItsDenm__TestSystem::DenmInd_gnNextHeader_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_gnHeaderType_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_gnHeaderSubtype_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_gnLifetime_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_gnTrafficClass_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_btpDestinationPort_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_btpInfo_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_ssp_raw_.fieldlength + LibItsDenm__TestSystem::DenmInd_its__aid_raw_.fieldlength ) / 8; // Decode DEN message if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is)), denm) == -1) { loggers::get_instance().warning("fx__dec__DenmInd: -1 result code was returned"); return -1; } p_denmInd.msgIn() = denm; // Decode lower layer data TTCN_Buffer decoding_buffer(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is) + is.lengthof() - s)); for (int i = 1; i < p_denmInd.get_count(); i++) { p_denmInd.get_at(i)->decode(*p_denmInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); } // End of 'for' statement loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnNextHeader_raw_.fieldlength / 8)) { p_denmInd.gnNextHeader().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnNextHeader() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnNextHeader()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnHeaderType_raw_.fieldlength / 8)) { p_denmInd.gnHeaderType().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnHeaderType() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnHeaderType()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_denmInd.gnHeaderSubtype().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnHeaderSubtype() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnHeaderSubtype()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnLifetime_raw_.fieldlength / 8)) { p_denmInd.gnLifetime().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnLifetime() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnLifetime()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_gnTrafficClass_raw_.fieldlength / 8)) { p_denmInd.gnTrafficClass().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnTrafficClass() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.gnTrafficClass()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_btpDestinationPort_raw_.fieldlength / 8)) { p_denmInd.btpDestinationPort().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.btpDestinationPort() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.btpDestinationPort()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_btpInfo_raw_.fieldlength / 8)) { p_denmInd.btpInfo().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.btpInfo() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.btpInfo()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_ssp_raw_.fieldlength / 8)) { p_denmInd.ssp().set_to_omit(); } else { BITSTRING bs; bs.decode(LibItsDenm__TestSystem::DenmInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.ssp() = bs; } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.ssp()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsDenm__TestSystem::DenmInd_its__aid_raw_.fieldlength / 8)) { p_denmInd.its__aid().set_to_omit(); } else { OCTETSTRING os; os.decode(LibItsDenm__TestSystem::DenmInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.its__aid() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__DENM: ", p_denmInd.its__aid()); loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); return 0; } Loading
ccsrc/Framework/src/Params.cc +7 −3 Original line number Diff line number Diff line Loading @@ -53,10 +53,14 @@ void Params::convert(Params& p_param, const std::string p_parameters) { void Params::log() { loggers::get_instance().log("Params::log"); if (size() == 0) { loggers::get_instance().log("\tEmpty"); } else { for (const_iterator it = cbegin(); it != cend(); ++it) { loggers::get_instance().log("\t(%s, %s)", it->first.c_str(), it->second.c_str()); } // End of 'for' statement } } void Params::reset() { loggers::get_instance().log("Params::reset"); Loading
ccsrc/Protocols/BTP/BTPCodec.cc +34 −34 Original line number Diff line number Diff line Loading @@ -92,14 +92,14 @@ int BTPCodec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_descr decode_(b.btpAHeader(), *b.btpAHeader().get_descriptor(), decoding_buffer); if (_params != NULL) { (*_params)[Params::btp_type] = std::string("btpA"); (*_params)[Params::btp_destination_port] = static_cast<int>(b.btpAHeader().destinationPort()); (*_params)[Params::btp_destination_port] = std::to_string(static_cast<int>(b.btpAHeader().destinationPort())); } } else if (_type == BTPCodec::btpB) { decode_(b.btpBHeader(), *b.btpBHeader().get_descriptor(), decoding_buffer); if (_params != NULL) { (*_params)[Params::btp_type] = std::string("btpB"); (*_params)[Params::btp_destination_port] = static_cast<int>(b.btpBHeader().destinationPort()); (*_params)[Params::btp_info] = static_cast<int>(b.btpBHeader().destinationPortInfo()); (*_params)[Params::btp_destination_port] = std::to_string(static_cast<int>(b.btpBHeader().destinationPort())); (*_params)[Params::btp_info] = std::to_string(static_cast<int>(b.btpBHeader().destinationPortInfo())); } } else { loggers::get_instance().error("BTPCodec::decode_: Invalid BTP type"); // Cannot be reached Loading
ccsrc/Protocols/BTP/BTPCodec.hh +2 −1 Original line number Diff line number Diff line Loading @@ -31,10 +31,11 @@ public: BTPCodec() : Codec<LibItsBtp__TypesAndValues::BtpPacket, LibItsBtp__TypesAndValues::BtpPacket>() { _type = BTPCodec::btpA; loggers::get_instance().log("BTPCodec::BTPCodec(D) :%d ", _type); }; virtual ~BTPCodec() { loggers::get_instance().log("BTPCodec::~BTPCodec"); }; void set_btp_type(const BTPCodec::BtpType p_BtpType); virtual int encode (const LibItsBtp__TypesAndValues::BtpPacket&, OCTETSTRING& data); virtual int decode (const OCTETSTRING& data, LibItsBtp__TypesAndValues::BtpPacket&, Params* params = NULL); inline void set_btp_type(const BTPCodec::BtpType p_btp_type) { _type = p_btp_type; }; private: BtpType _type; }; Loading