Commit 66fb8919 authored by vagrant's avatar vagrant
Browse files

Enhance GeoNetworking codec

parent de8ff769
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -9,12 +9,11 @@ class decoding_context {
  unsigned char _traffic_class;
  unsigned int  _lifetime;
  unsigned int  _length;
  std::string   _payload;

public:
  explicit decoding_context() : _payload() { reset(); };
  explicit decoding_context() { reset(); };
  ~decoding_context() { };
  inline void reset() { _next_header = 0xff; _header_type = 0xff; _header_sub_type = 0xff; _lifetime = 0; _length = -1; _payload.clear(); };
  inline void reset() { _next_header = 0xff; _header_type = 0xff; _header_sub_type = 0xff; _lifetime = 0; _length = -1; };

public:
  inline unsigned char get_next_header() { return _next_header; };
@@ -29,8 +28,4 @@ public:
  inline void set_lifetime(const unsigned int p_lifetime) { _lifetime = p_lifetime; };
  inline unsigned int get_length() { return _length; };
  inline void set_length(const unsigned int p_length) { _length = p_length; };


  inline std::string& get_payload() { return _payload; };
  inline void set_payload(const std::string& p_payload) { _payload.assign(p_payload); };
}; // End of class decoding_context
+5 −5
Original line number Diff line number Diff line
@@ -159,7 +159,6 @@ int geonetworking_codec::decode (const OCTETSTRING& data, LibItsGeoNetworking__T
    (*_params)[params::gn_header_sub_type] = std::to_string((unsigned int)_dc.get_header_sub_type());
    (*_params)[params::gn_traffic_class] = std::to_string((unsigned int)_dc.get_traffic_class());
    (*_params)[params::gn_lifetime] = std::to_string(_dc.get_lifetime());
    (*_params)[params::gn_payload] = _dc.get_payload();
    params->log();
  }
  
@@ -236,21 +235,22 @@ int geonetworking_codec::decode_ (Base_Type& type, const TTCN_Typedescriptor_t&
        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());
      OCTETSTRING os;
      if (_dc.get_length() != 0) {
        if ((unsigned char)s.lengthof() <= _dc.get_length()) {
          os = OCTETSTRING(s.lengthof(), p);
          _dc.set_payload(static_cast<const char *>(oct2str(os)));
          (*_params)[params::gn_payload] = static_cast<const char *>(oct2str(os));
        } else {
          os = OCTETSTRING(_dc.get_length(), p);
          _dc.set_payload(static_cast<const char *>(oct2str(os)));
          (*_params)[params::gn_payload] = static_cast<const char *>(oct2str(os));
        }
      } else {
        os = OCTETSTRING(0, nullptr);
        _dc.set_payload("");
        (*_params)[params::gn_payload] = "";
      }
      loggers::get_instance().log_msg("geonetworking_codec::decode_: Payload: os: ", os);
      loggers::get_instance().log("geonetworking_codec::decode_: Payload: '%s'", _dc.get_payload().c_str());
      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);
+15 −13
Original line number Diff line number Diff line
@@ -3,10 +3,11 @@
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.

# The GeoNetworking address of the IUT.
LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {                                                                                                           typeOfAddress := e_manual,
  stationType := e_passengerCar,
  stationCountryCode := 0,
  mid := '000000000001'O
LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {
  typeOfAddress := e_initial,
  stationType := e_roadSideUnit, #e_passengerCar
  stationCountryCode := 232,
  mid := '08002729c3e8'O
#  typeOfAddress := e_initial,
#  stationType := e_unknown, #e_roadSideUnit,
#  stationCountryCode := 0, #33,
@@ -14,7 +15,7 @@ LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {
}

LibItsGeoNetworking_Pics.PICS_GN_IS_MOBILE := false
LibItsGeoNetworking_Pics.PICS_GN_DEFAULT_HOP_LIMIT := 1
LibItsGeoNetworking_Pics.PICS_GN_DEFAULT_HOP_LIMIT := 10

LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_any
LibItsGeoNetworking_Pixits.PX_NEIGHBOUR_DISCOVERY_DELAY := 2.0
@@ -24,10 +25,10 @@ LibItsGeoNetworking_Pixits.PX_NEIGHBOUR_DISCOVERY_DELAY := 2.0
# you want to log into the file or display on console (standard error).

LogFile := "../logs/%e.%h-%r.%s"
#FileMask := LOG_ALL | USER | DEBUG | MATCHING
#ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING
FileMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
ConsoleMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
FileMask := LOG_ALL | USER | DEBUG | MATCHING
ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING
#FileMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
#ConsoleMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
LogSourceInfo := Stack
LogEntityName:= Yes
LogEventTypes:= Yes
@@ -100,7 +101,8 @@ LogEventTypes:= Yes
#     save_mode   : Set to 1 to save sent packet, 0 otherwise

# Single GeoNetworking component port
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=tap0,filter=and ether proto 0x8947)"
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=tap0,filter=and ether proto 0x8947)" # Nordsys
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730)/ETH(mac_src=080027d6c900)/PCAP(mac_src=080027d6c900,nic=eth2,filter=and ether proto 0x8947)" # Siemens

# Multiple GeoNetworking component portN
NodeA.geoNetworkingPort.params := "GN(ll_address=F8CAB808391A,latitude=43551050,longitude=10298730)/ETH(mac_src=080027500f9a)/PCAP(mac_src=080027500f9a,nic=tap0,filter=and ether proto 0x8947)"
@@ -110,10 +112,11 @@ NodeD.geoNetworkingPort.params := "GN(ll_address=F8CAB808391D,latitude=43551050,

# UpperTester port based on UDP
#system.utPort.params := "UT_GN/UDP(dst_ip=192.168.2.2)"
system.utPort.params := "UT_GN/UDP(dst_ip=172.23.0.1,dst_port=8000)"
#system.utPort.params := "UT_GN/UDP(dst_ip=172.23.0.1,dst_port=8000)" # Nordsys
system.utPort.params := "UT_GN/UDP(dst_ip=172.16.9.104,dst_port=12345)" # Siemens

[EXECUTE]
#ItsGeoNetworking_TestCases.TC_GEONW_FDV_BAH_BV_01
ItsGeoNetworking_TestCases.TC_GEONW_FDV_BAH_BV_01
#ItsGeoNetworking_TestCases.TC_GEONW_FDV_COH_BV_01
#ItsGeoNetworking_TestCases.TC_GEONW_FDV_COH_BV_02
#ItsGeoNetworking_TestCases.TC_GEONW_FDV_COH_BV_03
@@ -196,4 +199,3 @@ KillTimer := 10.0
LocalAddress := 127.0.0.1
TCPPort := 12000
NumHCs := 1
+4 −4
Original line number Diff line number Diff line
@@ -9,9 +9,9 @@ LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {
}

# GeoNetwoking only, no facility layer
LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_any
#LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_any
# With facility layer
#LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB
LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB

# Indicate which RSU to simulate
ItsRSUsSimulator_Pixits.PX_RSU_ID := 8;
@@ -27,8 +27,8 @@ ItsRSUsSimulator_Pixits.PX_ETSI_USE_CASE_ID := 6
# Indicate which zone to simulate
ItsRSUsSimulator_Pixits.PX_ETSI_ZONE_ID := 1

ItsRSUsSimulator_Pixits.PICS_GENERATE_BEACON   := true
ItsRSUsSimulator_Pixits.PICS_GENERATE_CAM      := false
ItsRSUsSimulator_Pixits.PICS_GENERATE_BEACON   := false
ItsRSUsSimulator_Pixits.PICS_GENERATE_CAM      := true
ItsRSUsSimulator_Pixits.PICS_GENERATE_DENM     := false
ItsRSUsSimulator_Pixits.PICS_GENERATE_IVIM     := false
ItsRSUsSimulator_Pixits.PICS_GENERATE_MAPEM    := false