Commit 0ca1d3a0 authored by Yann Garcia's avatar Yann Garcia
Browse files

Building AtsSAEM

parent dba15e9b
Loading
Loading
Loading
Loading
+28 −28
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ namespace LibItsSaem__EncdecDeclarations {
    }

    saem_codec                   codec;
    PIM__PDU__Descriptions::SAEM saem;
    SAEM__PDU__Descriptions::SAEM saem;
    OCTETSTRING                 is = bit2oct(b);

    if (codec.decode(is, saem) == -1) {
@@ -61,7 +61,7 @@ namespace LibItsSaem__EncdecDeclarations {
    }

    saem_codec                    codec;
    PIM__PDU__Descriptions::SAEM saem;
    SAEM__PDU__Descriptions::SAEM saem;
    OCTETSTRING                   is = bit2oct(b);

    // Calculate the size of the lower layers information
@@ -79,7 +79,7 @@ namespace LibItsSaem__EncdecDeclarations {
    p_saemInd.msgIn() = saem;
    // Decode lower layer data
    TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast<const uint8_t *>(is) + is.lengthof() - s));
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);
    // gnNextHeader
    if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsSaem__TypesAndValues::SaemInd_gnNextHeader_raw_.fieldlength / 8)) {
      p_saemInd.gnNextHeader().set_to_omit();
@@ -88,8 +88,8 @@ namespace LibItsSaem__EncdecDeclarations {
      os.decode(LibItsSaem__TypesAndValues::SaemInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW);
      p_saemInd.gnNextHeader() = oct2int(os);
    }
    loggers::get_instance().log_msg("fx__dec_PIM: gnNextHeader=", p_saemInd.gnNextHeader());
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_msg("fx__dec_SAEM: gnNextHeader=", p_saemInd.gnNextHeader());
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);
    // gnHeaderType
    if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsSaem__TypesAndValues::SaemInd_gnHeaderType_raw_.fieldlength / 8)) {
      p_saemInd.gnHeaderType().set_to_omit();
@@ -98,8 +98,8 @@ namespace LibItsSaem__EncdecDeclarations {
      os.decode(LibItsSaem__TypesAndValues::SaemInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW);
      p_saemInd.gnHeaderType() = oct2int(os);
    }
    loggers::get_instance().log_msg("fx__dec_PIM: gnHeaderType=", p_saemInd.gnHeaderType());
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_msg("fx__dec_SAEM: gnHeaderType=", p_saemInd.gnHeaderType());
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);
    // gnHeaderSubtype
    if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsSaem__TypesAndValues::SaemInd_gnHeaderSubtype_raw_.fieldlength / 8)) {
      p_saemInd.gnHeaderSubtype().set_to_omit();
@@ -108,8 +108,8 @@ namespace LibItsSaem__EncdecDeclarations {
      os.decode(LibItsSaem__TypesAndValues::SaemInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW);
      p_saemInd.gnHeaderSubtype() = oct2int(os);
    }
    loggers::get_instance().log_msg("fx__dec_PIM: gnHeaderSubtype=", p_saemInd.gnHeaderSubtype());
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_msg("fx__dec_SAEM: gnHeaderSubtype=", p_saemInd.gnHeaderSubtype());
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);
    // gnLifetime
    if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsSaem__TypesAndValues::SaemInd_gnLifetime_raw_.fieldlength / 8)) {
      p_saemInd.gnLifetime().set_to_omit();
@@ -118,8 +118,8 @@ namespace LibItsSaem__EncdecDeclarations {
      i.decode(LibItsSaem__TypesAndValues::SaemInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW);
      p_saemInd.gnLifetime() = i;
    }
    loggers::get_instance().log_msg("fx__dec_PIM: gnLifetime=", p_saemInd.gnLifetime());
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_msg("fx__dec_SAEM: gnLifetime=", p_saemInd.gnLifetime());
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);
    // gnTrafficClass
    if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsSaem__TypesAndValues::SaemInd_gnTrafficClass_raw_.fieldlength / 8)) {
      p_saemInd.gnTrafficClass().set_to_omit();
@@ -128,8 +128,8 @@ namespace LibItsSaem__EncdecDeclarations {
      os.decode(LibItsSaem__TypesAndValues::SaemInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW);
      p_saemInd.gnTrafficClass() = oct2int(os);
    }
    loggers::get_instance().log_msg("fx__dec_PIM: gnTrafficClass=", p_saemInd.gnTrafficClass());
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_msg("fx__dec_SAEM: gnTrafficClass=", p_saemInd.gnTrafficClass());
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);
    // btpDestinationPort
    if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsSaem__TypesAndValues::SaemInd_btpDestinationPort_raw_.fieldlength / 8)) {
      p_saemInd.btpDestinationPort().set_to_omit();
@@ -138,8 +138,8 @@ namespace LibItsSaem__EncdecDeclarations {
      i.decode(LibItsSaem__TypesAndValues::SaemInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW);
      p_saemInd.btpDestinationPort() = i;
    }
    loggers::get_instance().log_msg("fx__dec_PIM: btpDestinationPort=", p_saemInd.btpDestinationPort());
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_msg("fx__dec_SAEM: btpDestinationPort=", p_saemInd.btpDestinationPort());
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);
    // btpInfo
    if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsSaem__TypesAndValues::SaemInd_btpInfo_raw_.fieldlength / 8)) {
      p_saemInd.btpInfo().set_to_omit();
@@ -148,8 +148,8 @@ namespace LibItsSaem__EncdecDeclarations {
      i.decode(LibItsSaem__TypesAndValues::SaemInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW);
      p_saemInd.btpInfo() = i;
    }
    loggers::get_instance().log_msg("fx__dec_PIM: btpInfo=", p_saemInd.btpInfo());
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_msg("fx__dec_SAEM: btpInfo=", p_saemInd.btpInfo());
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);
    // ssp
    if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsSaem__TypesAndValues::SaemInd_ssp_raw_.fieldlength / 8)) {
      p_saemInd.ssp().set_to_omit();
@@ -158,8 +158,8 @@ namespace LibItsSaem__EncdecDeclarations {
      bs.decode(LibItsSaem__TypesAndValues::SaemInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW);
      p_saemInd.ssp() = bs;
    }
    loggers::get_instance().log_msg("fx__dec_PIM: ssp=", p_saemInd.ssp());
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_msg("fx__dec_SAEM: ssp=", p_saemInd.ssp());
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);
    // its__aid
    if (decoding_buffer.get_read_len() < static_cast<size_t>(LibItsSaem__TypesAndValues::SaemInd_its__aid_raw_.fieldlength / 8)) {
      p_saemInd.its__aid().set_to_omit();
@@ -168,14 +168,14 @@ namespace LibItsSaem__EncdecDeclarations {
      i.decode(LibItsSaem__TypesAndValues::SaemInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW);
      p_saemInd.its__aid() = i;
    }
    loggers::get_instance().log_msg("fx__dec_PIM: its_aid=", p_saemInd.its__aid());
    loggers::get_instance().log_to_hexa("fx__dec_PIM: ", decoding_buffer);
    loggers::get_instance().log_msg("fx__dec_SAEM: its_aid=", p_saemInd.its__aid());
    loggers::get_instance().log_to_hexa("fx__dec_SAEM: ", decoding_buffer);

    return 0;
  }

  BITSTRING fx__enc__PIM(const PIM__PDU__Descriptions::SAEM &p_cam) {
    loggers::get_instance().log_msg(">>> fx__enc__PIM: ", p_cam);
  BITSTRING fx__enc__SAEM(const SAEM__PDU__Descriptions::SAEM &p_cam) {
    loggers::get_instance().log_msg(">>> fx__enc__SAEM: ", p_cam);

    saem_codec   codec;
    OCTETSTRING os;
@@ -183,13 +183,13 @@ namespace LibItsSaem__EncdecDeclarations {
    return oct2bit(os);
  }

  INTEGER fx__dec__PIM(BITSTRING &b, PIM__PDU__Descriptions::SAEM &p) {
    loggers::get_instance().log(">>> fx__dec__PIM");
  INTEGER fx__dec__SAEM(BITSTRING &b, SAEM__PDU__Descriptions::SAEM &p) {
    loggers::get_instance().log(">>> fx__dec__SAEM");
    saem_codec   codec;
    OCTETSTRING is = bit2oct(b);

    if (codec.decode(OCTETSTRING(is.lengthof(), static_cast<const uint8_t *>(is)), p) == -1) {
      loggers::get_instance().warning("fx__dec__PIM: -1 result code was returned");
      loggers::get_instance().warning("fx__dec__SAEM: -1 result code was returned");
      return -1;
    }

+7 −7
Original line number Diff line number Diff line
@@ -4,10 +4,10 @@
#include "loggers.hh"

extern "C" {
extern asn_TYPE_descriptor_t asn_DEF_ParkingInformationMessage;
extern asn_TYPE_descriptor_t asn_DEF_SAEM;
}

int saem_codec::encode(const SAEM__PDU__Descriptions::ParkingInformationMessage &p_saem, OCTETSTRING &data) {
int saem_codec::encode(const SAEM__PDU__Descriptions::SAEM &p_saem, OCTETSTRING &data) {
  loggers::get_instance().log(">>> saem_codec::encode");

  BITSTRING b;
@@ -19,7 +19,7 @@ int saem_codec::encode(const SAEM__PDU__Descriptions::ParkingInformationMessage
  return rc;
}

int saem_codec::decode(const OCTETSTRING &data, SAEM__PDU__Descriptions::ParkingInformationMessage &p_saem, params_its *params) {
int saem_codec::decode(const OCTETSTRING &data, SAEM__PDU__Descriptions::SAEM &p_saem, params_its *params) {
  loggers::get_instance().log_msg(">>> saem_codec::decode: ", data);

  int rc = asn_codec.decode(oct2bit(data), p_saem);
@@ -30,10 +30,10 @@ int saem_codec::decode(const OCTETSTRING &data, SAEM__PDU__Descriptions::Parking
  return rc;
}

int saem_pdu_codec::encode(const SAEM__PDU__Descriptions::ParkingInformationMessage &p_saem, BITSTRING &p_data) {
  return _encode(SAEM__PDU__Descriptions::ParkingInformationMessage_descr_, asn_DEF_ParkingInformationMessage, p_saem, p_data);
int saem_pdu_codec::encode(const SAEM__PDU__Descriptions::SAEM &p_saem, BITSTRING &p_data) {
  return _encode(SAEM__PDU__Descriptions::SAEM_descr_, asn_DEF_SAEM, p_saem, p_data);
}

int saem_pdu_codec::decode(const BITSTRING &p_data, SAEM__PDU__Descriptions::ParkingInformationMessage &p_saem) {
  return _decode(SAEM__PDU__Descriptions::ParkingInformationMessage_descr_, asn_DEF_ParkingInformationMessage, p_data, p_saem);
int saem_pdu_codec::decode(const BITSTRING &p_data, SAEM__PDU__Descriptions::SAEM &p_saem) {
  return _decode(SAEM__PDU__Descriptions::SAEM_descr_, asn_DEF_SAEM, p_data, p_saem);
}
+32 −0
Original line number Diff line number Diff line
@@ -8,25 +8,25 @@
class BITSTRING;   //! Forward declaration of TITAN class
class OCTETSTRING; //! Forward declaration of TITAN class

namespace SAEM__PDU__Descriptions { //! Forward declaration of asn1c ParkingInformationMessage class
  class ParkingInformationMessage;
namespace SAEM__PDU__Descriptions { //! Forward declaration of asn1c SAEM class
  class SAEM;
}

class saem_pdu_codec : per_codec<SAEM__PDU__Descriptions::ParkingInformationMessage> {
class saem_pdu_codec : per_codec<SAEM__PDU__Descriptions::SAEM> {
public:
  explicit saem_pdu_codec(){};
  virtual int encode(const SAEM__PDU__Descriptions::ParkingInformationMessage &saem, BITSTRING &data);
  virtual int decode(const BITSTRING &data, SAEM__PDU__Descriptions::ParkingInformationMessage &);
  virtual int encode(const SAEM__PDU__Descriptions::SAEM &saem, BITSTRING &data);
  virtual int decode(const BITSTRING &data, SAEM__PDU__Descriptions::SAEM &);
};

class saem_codec : public codec<SAEM__PDU__Descriptions::ParkingInformationMessage, SAEM__PDU__Descriptions::ParkingInformationMessage> {
class saem_codec : public codec<SAEM__PDU__Descriptions::SAEM, SAEM__PDU__Descriptions::SAEM> {
  saem_pdu_codec asn_codec;

public:
  explicit saem_codec() : codec<SAEM__PDU__Descriptions::ParkingInformationMessage, SAEM__PDU__Descriptions::ParkingInformationMessage>(), asn_codec(){};
  explicit saem_codec() : codec<SAEM__PDU__Descriptions::SAEM, SAEM__PDU__Descriptions::SAEM>(), asn_codec(){};
  virtual ~saem_codec(){};

  virtual int encode(const SAEM__PDU__Descriptions::ParkingInformationMessage &saem, OCTETSTRING &data);
  virtual int decode(const OCTETSTRING &data, SAEM__PDU__Descriptions::ParkingInformationMessage &saem, params_its *params = NULL);
  virtual int encode(const SAEM__PDU__Descriptions::SAEM &saem, OCTETSTRING &data);
  virtual int decode(const OCTETSTRING &data, SAEM__PDU__Descriptions::SAEM &saem, params_its *params = NULL);
};
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ do
    then
        git checkout --recurse-submodules $NEW_BRANCH
        ln -sf SAEM-PDU-Descriptions.asn SAEM_PDU_Descriptions.asn
        ln -sf ITSsa1-1-0-16460-2-1.asn ITSsa1.asn
        ln -sf ITSee1-1-0-16460-4-1.asn ITSee1.asn
    else
        git checkout --recurse-submodules $ASN1_BRANCH
        if [ -f ETSI-ITS-CDD.asn ]
Loading