Commit 95393588 authored by Yann Garcia's avatar Yann Garcia
Browse files

Add support of SDP

parent da86969e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ public: //! \publicsection
  static const std::string& nic;                   //! Network Interface Card parameter name
  static const std::string& latitude;              //! Test system Latitude parameter name
  static const std::string& longitude;             //! Test system Longitude parameter name
  static const std::string& device_mode;           //! To indicate to the lower layer to act as a standalone device
  
  static const std::string& server;                //! HTTP server address (e.g. www.etsi.org)
  static const std::string& port;                  //! HTTP server port. Default: 80
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ const std::string& params::eth_type = std::string("eth_type");
const std::string& params::nic = std::string("nic");
const std::string& params::latitude = std::string("latitude");
const std::string& params::longitude = std::string("longitude");
const std::string& params::device_mode = std::string("device_mode");

const std::string& params::server = std::string("server");
const std::string& params::port = std::string("port");
+3 −3
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
        it = _codecs.find("http_its"); // TODO Use params
        if (it != _codecs.cend()) {
          loggers::get_instance().log("http_codec::encode_body: Call '%s'", it->first.c_str());
          _codecs["http_its"]->encode((Record_Type&)binary_body.ieee1609dot2__data(), p_encoding_buffer); // TODO Use params
          //_codecs["http_its"]->encode((Record_Type&)binary_body.ieee1609dot2__data(), p_encoding_buffer); // TODO Use params
          
          
#if defined(GEMALTO_FIX) // Temporary fix to be removed
@@ -567,12 +567,12 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
            }
            }*/
        loggers::get_instance().log("http_codec::decode_body: Call '%s'", it->first.c_str());
        http_etsi_ieee1609dot2_codec* codec = new http_etsi_ieee1609dot2_codec();
        /*http_etsi_ieee1609dot2_codec* codec = new http_etsi_ieee1609dot2_codec();
        if (codec->decode(body, binary_body.ieee1609dot2__data()) == 0) {
          message_body.binary__body() = binary_body;
          processed = true;
        }
        delete codec;
        delete codec;*/
      }
    } // TODO Add new HTTP message codec here
    if (!processed) {
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ private:

  int decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAndValues::HeaderLines& headers);
  int decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValues::HeaderLine& header);
  int decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody& message_body);
  int decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody& message_body, const std::string& p_content_type);
  int get_line(TTCN_Buffer& buffer, CHARSTRING& to, const bool concatenate_header_lines = false);

}; // End of class http_codec
+12 −4
Original line number Diff line number Diff line
@@ -337,10 +337,18 @@ int sip_codec_request::encode_request_message_body(const LibSip__MessageBodyType
    sdp_message_t* sdp_body;
    ::sdp_message_init(&sdp_body);
    
    INTEGER sdp.protocol__version();
    SDP__Origin sdp.origin();
    CHARSTRING sdp.session__name();

    INTEGER version = sdp.protocol__version();
    ::sdp_message_v_version_set(sdp_body, (char*)std::to_string(static_cast<const int>(version)).c_str());
    LibSip__SDPTypes::SDP__Origin origin = sdp.origin();
    ::sdp_message_o_origin_set(
                               sdp_body,
                               (char*)static_cast<const char*>(origin.user__name()),
                               (char*)static_cast<const char*>(origin.session__id()),
                               (char*)static_cast<const char*>(origin.session__version()),
                               (char*)static_cast<const char*>(origin.net__type()),
                               (char*)static_cast<const char*>(origin.addr__type()),
                               (char*)static_cast<const char*>(origin.addr())
                               );
    
    char* buff = nullptr;
    ::sdp_message_to_str(sdp_body, &buff);