Commit 51557cdc authored by garciay's avatar garciay
Browse files

Add SIP encode codec (basics)

parent 1b32a661
Loading
Loading
Loading
Loading
+177 −93
Original line number Diff line number Diff line
@@ -133,11 +133,10 @@ int sip_codec_request::encode_request_headers(const LibSip__SIPTypesAndValues::M
{
  loggers::get_instance().log_msg(">>> sip_codec_request::encode_request_headers: ", p_msg_header);
  
  // Encode mandatory fieds
  // Encode mandatory fields
  // From
  const LibSip__SIPTypesAndValues::From from = p_msg_header.fromField();
  osip_from_t* from_header = nullptr;
  if (encode_from_header(p_msg_header.fromField(), from_header) == -1) {
  if (encode_from_header(p_msg_header.fromField(), &from_header) == -1) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Faile to encode From header");
    return -1;
  }
@@ -145,24 +144,24 @@ int sip_codec_request::encode_request_headers(const LibSip__SIPTypesAndValues::M
  ::osip_from_to_str(from_header, &hvalue);
  loggers::get_instance().log("sip_codec_request::encode_request_headers: From:%s", hvalue);
  ::osip_message_set_from(p_sip_message, hvalue);
  //  ::osip_from_free(from_header);
  ::osip_from_free(from_header);
  osip_free(hvalue);
  
  // To
  const LibSip__SIPTypesAndValues::To to = p_msg_header.toField();
  osip_to_t* to_header = nullptr;
  if (encode_to_header(p_msg_header.toField(), to_header) == -1) {
  if (encode_to_header(p_msg_header.toField(), &to_header) == -1) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Faile to encode To header");
    return -1;
  }
  ::osip_to_to_str(to_header, &hvalue);
  loggers::get_instance().log("sip_codec_request::encode_request_headers: To:%s", hvalue);
  int r = ::osip_to_to_str(to_header, &hvalue);
  loggers::get_instance().log("sip_codec_request::encode_request_headers: To:'%s'- result:%d", hvalue, r);
  ::osip_message_set_to(p_sip_message, hvalue);
  //  ::osip_to_free(to_header);
  ::osip_to_free(to_header);
  osip_free(hvalue);

  // Via
  const LibSip__SIPTypesAndValues::Via via = p_msg_header.via();
  osip_via_t* via_header = nullptr;
  if (encode_via_header(p_msg_header.via(), via_header) == -1) {
  if (encode_via_header(p_msg_header.via(), &via_header) == -1) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Faile to encode Via header");
    return -1;
  }
@@ -170,31 +169,22 @@ int sip_codec_request::encode_request_headers(const LibSip__SIPTypesAndValues::M
  loggers::get_instance().log("sip_codec_request::encode_request_headers: Via:%s", hvalue);
  ::osip_message_set_via(p_sip_message, hvalue);
  //  ::osip_via_free(via_header);
  osip_free(hvalue);

  // Decode Optional fields





  char* buffer = nullptr;
  size_t length = 0;
  int result = ::osip_message_to_str(p_sip_message, &buffer, &length);
  if (result != 0) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Failed to encode data structures");
  } else {
    loggers::get_instance().log("sip_codec_request::encode_request_headers: Message:%s", buffer);
  // MaxForwards
  if (encode_max_forwards_header(p_msg_header.maxForwards(), &p_sip_message) == -1) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Faile to encode MaxForwards header");
    return -1;
  }
  // Supported
  if (encode_supported_header(p_msg_header.supported(), &p_sip_message) == -1) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Faile to encode Supported header");
    return -1;
  }
  










  // TODO continue

  
  return 0;
@@ -278,94 +268,122 @@ void sip_codec_request::encode_host_port(const LibSip__SIPTypesAndValues::HostPo
  } else {
    p_host.clear();
  }
  loggers::get_instance().log("sip_codec_request::encode_host_port: host:'%s'", p_host.c_str());
  if (p_host_port.portField().is_present()) {
    p_port.assign(std::to_string(static_cast<int>(static_cast<INTEGER>(p_host_port.portField()))));
  } else {
    p_port.clear();
  }
  loggers::get_instance().log("sip_codec_request::encode_port_port: port:'%s'", p_port.c_str());
} // End of method encode_host_port

int sip_codec_request::encode_from_header(const LibSip__SIPTypesAndValues::From& p_from, osip_from_t* p_from_header) {
int sip_codec_request::encode_from_header(const LibSip__SIPTypesAndValues::From& p_from, osip_from_t** p_from_header) {
  loggers::get_instance().log(">>> sip_codec_request::encode_from_header");
  
  ::osip_from_init(&p_from_header);
  ::osip_from_init(p_from_header);
  osip_uri_t* uri = nullptr;
  const LibSip__SIPTypesAndValues::Addr__Union& a = p_from.addressField();
  if (a.ischosen(LibSip__SIPTypesAndValues::Addr__Union::ALT_nameAddr)) {
    const LibSip__SIPTypesAndValues::NameAddr& addr = a.nameAddr();
    osip_uri_t *uri;
    if (encode_sip_url(addr.addrSpec(), &uri) == -1) {
      loggers::get_instance().warning("sip_codec_request::encode_from_header: Failed to encode SipUrl");
      ::osip_from_free(p_from_header);
      p_from_header = nullptr;
      ::osip_from_free(*p_from_header);
      *p_from_header = nullptr;
      return -1;
    }
    ::osip_from_set_url(p_from_header, uri);
    ::osip_from_set_url(*p_from_header, uri);
    if (addr.displayName().is_present()) {
      const LibSip__SIPTypesAndValues::DisplayName& n = static_cast<const LibSip__SIPTypesAndValues::DisplayName&>(addr.displayName());
      if (n.ischosen(LibSip__SIPTypesAndValues::DisplayName::ALT_token)) {
        ::osip_from_set_displayname(p_from_header, (char*)static_cast<const char*>(static_cast<CHARSTRING>(n.token())));
        ::osip_from_set_displayname(*p_from_header, (char*)static_cast<const char*>(static_cast<CHARSTRING>(n.token())));
      } else if (n.ischosen(LibSip__SIPTypesAndValues::DisplayName::ALT_quotedString)) {
        ::osip_from_set_displayname(p_from_header, (char*)static_cast<const char*>(static_cast<CHARSTRING>(n.quotedString())));
        ::osip_from_set_displayname(*p_from_header, (char*)static_cast<const char*>(static_cast<CHARSTRING>(n.quotedString())));
      } else {
        loggers::get_instance().warning("sip_codec_request::encode_from_header: Failed to encode DisplayName");
        ::osip_from_free(p_from_header);
        p_from_header = nullptr;
        ::osip_from_free(*p_from_header);
        *p_from_header = nullptr;
        return -1;
      }
    }
  } else if (a.ischosen(LibSip__SIPTypesAndValues::Addr__Union::ALT_addrSpecUnion)) {
    osip_uri_t *uri;
    if (encode_sip_url(a.addrSpecUnion(), &uri) == -1) {
      loggers::get_instance().warning("sip_codec_request::encode_from_header: Failed to encode SipUrl");
      ::osip_from_free(p_from_header);
      p_from_header = nullptr;
      ::osip_from_free(*p_from_header);
      *p_from_header = nullptr;
      return -1;
    }
    ::osip_from_set_url(p_from_header, uri);
    ::osip_from_set_url(*p_from_header, uri);
  } else {
    loggers::get_instance().warning("sip_codec_request::encode_from_header: Failed to encode Addr__Union");
    ::osip_from_free(p_from_header);
    p_from_header = nullptr;
    ::osip_from_free(*p_from_header);
    *p_from_header = nullptr;
    return -1;
  }
  if (p_from.fromParams().is_present()) {
    const LibSip__Common::SemicolonParam__List& l = static_cast<const LibSip__Common::SemicolonParam__List>(p_from.fromParams());
    // TODO encode_semi_colon_params(l, );
    loggers::get_instance().warning("sip_codec_request::encode_from_header: Failed to encode SemicolonParam__List");
    ::osip_from_free(p_from_header);
    p_from_header = nullptr;
    return -1;
    encode_semi_colon_params(static_cast<const LibSip__Common::SemicolonParam__List>(p_from.fromParams()), &(*p_from_header)->gen_params);
  }
  
  return 0;
} // End of method encode_from_header

int sip_codec_request::encode_to_header(const LibSip__SIPTypesAndValues::To& p_to, osip_to_t* p_to_header) {
int sip_codec_request::encode_max_forwards_header(const OPTIONAL<LibSip__SIPTypesAndValues::MaxForwards>& p_max_forwards, osip_message_t** p_sip_message) {
  loggers::get_instance().log(">>> sip_codec_request::encode_max_forwards_header");

  if (!p_max_forwards.is_present()) {
    return 0;
  }
  
  const LibSip__SIPTypesAndValues::MaxForwards& max_forwards = static_cast<const LibSip__SIPTypesAndValues::MaxForwards&>(*p_max_forwards.get_opt_value());
  osip_message_set_max_forwards(*p_sip_message, std::to_string(static_cast<int>(max_forwards.forwards())).c_str());
  
  return 0;
}

int sip_codec_request::encode_supported_header(const  OPTIONAL<LibSip__SIPTypesAndValues::Supported>& p_supported, osip_message_t** p_sip_message) {
  loggers::get_instance().log(">>> sip_codec_request::encode_supported_header");

  if (!p_supported.is_present()) {
    return 0;
  }
  
  const LibSip__SIPTypesAndValues::Supported& supported = static_cast<const LibSip__SIPTypesAndValues::Supported&>(*p_supported.get_opt_value());
  const OPTIONAL<LibSip__SIPTypesAndValues::OptionTag__List>& tags = supported.optionsTags();
  if (!tags.is_present()) {
    return 0;
  }
  if (encode_option_tag_list(static_cast<const LibSip__SIPTypesAndValues::OptionTag__List&>(*tags.get_opt_value()), p_sip_message) == -1) {
    return -1;
  }
  
  return 0;
}

int sip_codec_request::encode_to_header(const LibSip__SIPTypesAndValues::To& p_to, osip_to_t** p_to_header) {
  loggers::get_instance().log(">>> sip_codec_request::encode_to_header");
  
  ::osip_to_init(&p_to_header);
  ::osip_to_init(p_to_header);
  const LibSip__SIPTypesAndValues::Addr__Union& a = p_to.addressField();
  if (a.ischosen(LibSip__SIPTypesAndValues::Addr__Union::ALT_nameAddr)) {
    const LibSip__SIPTypesAndValues::NameAddr& addr = a.nameAddr();
    osip_uri_t *uri;
    if (encode_sip_url(addr.addrSpec(), &uri) == -1) {
      loggers::get_instance().warning("sip_codec_request::encode_to_header: Failed to encode SipUrl");
      ::osip_to_free(p_to_header);
      p_to_header = nullptr;
      ::osip_to_free(*p_to_header);
      *p_to_header = nullptr;
      return -1;
    }
    ::osip_to_set_url(p_to_header, uri);
    ::osip_to_set_url(*p_to_header, uri);
    //::osip_uri_free(uri);
    if (addr.displayName().is_present()) {
      const LibSip__SIPTypesAndValues::DisplayName& n = static_cast<const LibSip__SIPTypesAndValues::DisplayName&>(addr.displayName());
      if (n.ischosen(LibSip__SIPTypesAndValues::DisplayName::ALT_token)) {
        ::osip_to_set_displayname(p_to_header, (char*)static_cast<const char*>(static_cast<CHARSTRING>(n.token())));
        ::osip_to_set_displayname(*p_to_header, (char*)static_cast<const char*>(static_cast<CHARSTRING>(n.token())));
      } else if (n.ischosen(LibSip__SIPTypesAndValues::DisplayName::ALT_quotedString)) {
        ::osip_to_set_displayname(p_to_header, (char*)static_cast<const char*>(static_cast<CHARSTRING>(n.quotedString())));
        ::osip_to_set_displayname(*p_to_header, (char*)static_cast<const char*>(static_cast<CHARSTRING>(n.quotedString())));
      } else {
        loggers::get_instance().warning("sip_codec_request::encode_to_header: Failed to encode DisplayName");
        ::osip_to_free(p_to_header);
        p_to_header = nullptr;
        ::osip_to_free(*p_to_header);
        *p_to_header = nullptr;
        return -1;
      }
    }
@@ -373,59 +391,59 @@ int sip_codec_request::encode_to_header(const LibSip__SIPTypesAndValues::To& p_t
    osip_uri_t *uri;
    if (encode_sip_url(a.addrSpecUnion(), &uri) == -1) {
      loggers::get_instance().warning("sip_codec_request::encode_to_header: Failed to encode SipUrl");
      ::osip_to_free(p_to_header);
      p_to_header = nullptr;
      ::osip_to_free(*p_to_header);
      *p_to_header = nullptr;
      return -1;
    }
    ::osip_to_set_url(p_to_header, uri);
    ::osip_to_set_url(*p_to_header, uri);
  } else {
    loggers::get_instance().warning("sip_codec_request::encode_to_header: Failed to encode Addr__Union");
    ::osip_to_free(p_to_header);
    p_to_header = nullptr;
    ::osip_to_free(*p_to_header);
    *p_to_header = nullptr;
    return -1;
  }
  if (p_to.toParams().is_present()) {
    const LibSip__Common::SemicolonParam__List& l = static_cast<const LibSip__Common::SemicolonParam__List>(p_to.toParams());
    // TODO encode_semi_colon_params(l, );
    loggers::get_instance().warning("sip_codec_request::encode_to_header: Failed to encode SemicolonParam__List");
    ::osip_to_free(p_to_header);
    p_to_header = nullptr;
    ::osip_to_free(*p_to_header);
    *p_to_header = nullptr;
    return -1;
  }
  
  return 0;
} // End of method encode_to_header

int sip_codec_request::encode_via_header(const LibSip__SIPTypesAndValues::Via& p_via, osip_via_t* p_via_header) {
  loggers::get_instance().log(">>> sip_codec_request::encode_via_header");
int sip_codec_request::encode_via_header(const LibSip__SIPTypesAndValues::Via& p_via, osip_via_t** p_via_header) {
  loggers::get_instance().log_msg(">>> sip_codec_request::encode_via_header: ", p_via);
  
  ::osip_via_init(&p_via_header);
  ::osip_via_init(p_via_header);
  const LibSip__SIPTypesAndValues::ViaBody__List& l = p_via.viaBody();
  for (int i = 0; i < l.size_of(); i++) {
    const LibSip__SIPTypesAndValues::ViaBody v = l[i];
    loggers::get_instance().log_msg("sip_codec_request::encode_via_header: Processing ", v);

    ::via_set_protocol(p_via_header, (char*)static_cast<const char *>(v.sentProtocol().protocolName()));
    ::via_set_version(p_via_header, (char*)static_cast<const char *>(v.sentProtocol().protocolVersion()));
    ::via_set_comment(p_via_header, (char*)static_cast<const char *>(v.sentProtocol().transport()));
    ::via_set_protocol(*p_via_header, (char*)static_cast<const char *>(v.sentProtocol().protocolName()));
    ::via_set_version(*p_via_header, (char*)static_cast<const char *>(v.sentProtocol().protocolVersion()));
    ::via_set_comment(*p_via_header, (char*)static_cast<const char *>(v.sentProtocol().transport()));
    std::string host;
    std::string port;
    encode_host_port(v.sentBy(), host, port);
    if (!host.empty()) {
      ::via_set_host(p_via_header, (char*)host.c_str());
      ::via_set_host(*p_via_header, (char*)::strdup(host.c_str()));
    }
    if (!port.empty()) {
      ::via_set_port (p_via_header, (char*)port.c_str());
      ::via_set_port (*p_via_header, (char*)::strdup(port.c_str()));
    }
    
    if (v.viaParams().is_present()) {
      const LibSip__Common::SemicolonParam__List& params = static_cast<LibSip__Common::SemicolonParam__List>(v.viaParams());
      // TODO encode_semi_colon_params(l, );
      loggers::get_instance().warning("sip_codec_request::encode_via_header: Failed to encode SemicolonParam__List");
      ::osip_via_free(p_via_header);
      p_via_header = nullptr;
      ::osip_via_free(*p_via_header);
      *p_via_header = nullptr;
      return -1;
    }
    
  } // End of 'for' statement
  
  return 0;
@@ -445,7 +463,7 @@ void sip_codec_request::decode_headers(const osip_message_t* p_sip_message, LibS
  loggers::get_instance().log(">>> sip_codec_request::decode_headers");
  
  LibSip__SIPTypesAndValues::MessageHeader headers;
  // Fill mandatory fields
  // Decode mandatory fields
  // From
  LibSip__SIPTypesAndValues::From from_header;
  decode_from_header(::osip_message_get_from(p_sip_message), from_header);
@@ -471,7 +489,7 @@ void sip_codec_request::decode_headers(const osip_message_t* p_sip_message, LibS
    headers.via().set_to_omit();
  }

  // Fill Optional fields
  // Decode Optional fields
  LibSip__SIPTypesAndValues::Accept accept_header;
  decode_accept_header(p_sip_message, accept_header);
  if (accept_header.is_value()) {
@@ -684,6 +702,32 @@ void sip_codec_request::decode_payload(const osip_message_t* p_sip_message, LibS
  
} // End of method decode_payload

int sip_codec_request::encode_semi_colon_params(const LibSip__Common::SemicolonParam__List& p_list, osip_list_t* p_sip_list) {
  loggers::get_instance().log_msg(">>> sip_codec_request::encode_semi_colon_params: ", p_list);

  if (p_list.size_of() != 0) {
    for (int i = 0; i < p_list.size_of(); i++) {
      const LibSip__Common::GenericParam& param = static_cast<const LibSip__Common::GenericParam&>(*p_list.get_at(i));
      loggers::get_instance().log_msg("sip_codec_request::encode_semi_colon_params: param: ", param);
      if (param.paramValue().is_present()) {
        const LibSip__Common::GenValue& v = static_cast<const LibSip__Common::GenValue&>(*param.paramValue().get_opt_value());
        loggers::get_instance().log_msg("sip_codec_request::encode_semi_colon_params: v: ", v);
        if (v.ischosen(LibSip__Common::GenValue::ALT_tokenOrHost)) {
          loggers::get_instance().log_msg("sip_codec_request::encode_semi_colon_params: tokenOrHost: ", v.tokenOrHost());
          ::osip_generic_param_add(p_sip_list, (char*)static_cast<const char*>(param.id()), (char*)static_cast<const char*>(v.tokenOrHost()));
        } else {
          loggers::get_instance().log_msg("sip_codec_request::encode_semi_colon_params: quotedString: ", v.quotedString());
          ::osip_generic_param_add(p_sip_list, (char*)static_cast<const char*>(param.id()), (char*)static_cast<const char*>(v.quotedString()));
        }
      }
    } // End of 'for' statement
  } else {
    // Nothing to do
  }
  
  return 0;
}

void sip_codec_request::decode_semi_colon_params(const osip_list_t& p_sip_list, OPTIONAL<LibSip__Common::SemicolonParam__List>& p_list) {
  loggers::get_instance().log(">>> sip_codec_request::decode_semi_colon_params");

@@ -709,6 +753,29 @@ void sip_codec_request::decode_semi_colon_params(const osip_list_t& p_sip_list,
  loggers::get_instance().log_msg("<<< sip_codec_request::decode_semi_colon_params: ", p_list);
} // End of method decode_semi_colon_params

int sip_codec_request::encode_ampersand_params(const LibSip__Common::AmpersandParam__List& p_list, osip_list_t** p_sip_list) {
  loggers::get_instance().log(">>> sip_codec_request::encode_ampersand_params");

  if (p_list.size_of() != 0) {
    ::osip_list_init(*p_sip_list);
    for (int i = 0; i < p_list.size_of(); i++) {
      const LibSip__Common::GenericParam& param = static_cast<const LibSip__Common::GenericParam&>(*p_list.get_at(i));
      if (param.paramValue().is_present()) {
        const LibSip__Common::GenValue& v = static_cast<const LibSip__Common::GenValue&>(*param.paramValue().get_opt_value());
        if (v.ischosen(LibSip__Common::GenValue::ALT_tokenOrHost)) {
          ::osip_generic_param_add(*p_sip_list, (char*)static_cast<const char*>(param.id()), (char*)static_cast<const char*>(v.tokenOrHost()));
        } else {
          ::osip_generic_param_add(*p_sip_list, (char*)static_cast<const char*>(param.id()), (char*)static_cast<const char*>(v.quotedString()));
        }
      }
    } // End of 'for' statement
  } else {
    *p_sip_list = nullptr;
  }
  
  return 0;
}

void sip_codec_request::decode_ampersand_params(const osip_list_t& p_sip_list, OPTIONAL<LibSip__Common::AmpersandParam__List>& p_list) {
  loggers::get_instance().log(">>> sip_codec_request::decode_ampersand_params");

@@ -734,6 +801,21 @@ void sip_codec_request::decode_ampersand_params(const osip_list_t& p_sip_list, O
  loggers::get_instance().log_msg("<<< sip_codec_request::decode_ampersand_params: ", p_list);
} // End of method decode_ampersand_params

int sip_codec_request::encode_option_tag_list(const LibSip__SIPTypesAndValues::OptionTag__List& p_options_tags, osip_message_t** p_sip_message) {
  loggers::get_instance().log(">>> sip_codec_request::encode_option_tag_list");

  if (p_options_tags.size_of() != 0) {
    std::string str(static_cast<const char*>(*static_cast<const CHARSTRING*>(p_options_tags.get_at(0))));
    for (int i = 1; i < p_options_tags.size_of() - 1; i++) {
      str += "," + std::string(static_cast<const char*>(*static_cast<const CHARSTRING*>(p_options_tags.get_at(i))));
    } // End of 'for' statement
    osip_message_set_supported(*p_sip_message, str.c_str());
  } else {
    osip_message_set_supported(*p_sip_message, "");
  }
  return 0;
}

void sip_codec_request::decode_option_tag_list(const char* p_list, OPTIONAL<LibSip__SIPTypesAndValues::OptionTag__List>& p_options_tags)
{
  loggers::get_instance().log(">>> sip_codec_request::decode_option_tag_list");
@@ -1151,17 +1233,18 @@ void sip_codec_request::decode_from_header(const osip_from_t* p_sip_from, LibSip
  // Addr_Union
  LibSip__SIPTypesAndValues::SipUrl uri;
  decode_uri(uri, ::osip_from_get_url((osip_from_t*)p_sip_from));
  LibSip__SIPTypesAndValues::Addr__Union addr;
  OPTIONAL<LibSip__SIPTypesAndValues::DisplayName> display_name;
  if (::osip_from_get_displayname((osip_from_t*)p_sip_from) != nullptr) {
    LibSip__SIPTypesAndValues::DisplayName n;
    n.token() = CHARSTRING(::osip_from_get_displayname((osip_from_t*)p_sip_from));
    display_name = OPTIONAL<LibSip__SIPTypesAndValues::DisplayName>(n);
    LibSip__SIPTypesAndValues::NameAddr name_addr(display_name, uri);
    addr.nameAddr() = name_addr;
  } else {
    display_name.set_to_omit();
    addr.addrSpecUnion() = uri;
  }
  LibSip__SIPTypesAndValues::NameAddr name_addr(display_name, uri);
  LibSip__SIPTypesAndValues::Addr__Union addr;
  addr.nameAddr() = name_addr;
  p_from_header.addressField() = addr;
  // Params
  OPTIONAL<LibSip__Common::SemicolonParam__List> params;
@@ -1222,17 +1305,18 @@ void sip_codec_request::decode_to_header(const osip_to_t* p_sip_to, LibSip__SIPT
  // Addr_Union
  LibSip__SIPTypesAndValues::SipUrl uri;
  decode_uri(uri, ::osip_to_get_url((osip_to_t*)p_sip_to));
  LibSip__SIPTypesAndValues::Addr__Union addr;
  OPTIONAL<LibSip__SIPTypesAndValues::DisplayName> display_name;
  if (::osip_to_get_displayname((osip_to_t*)p_sip_to) != nullptr) {
    LibSip__SIPTypesAndValues::DisplayName n;
    n.token() = CHARSTRING(::osip_to_get_displayname((osip_to_t*)p_sip_to));
    display_name = OPTIONAL<LibSip__SIPTypesAndValues::DisplayName>(n);
    LibSip__SIPTypesAndValues::NameAddr name_addr(display_name, uri);
    addr.nameAddr() = name_addr;
  } else {
    display_name.set_to_omit();
    addr.addrSpecUnion() = uri;
  }
  LibSip__SIPTypesAndValues::NameAddr name_addr(display_name, uri);
  LibSip__SIPTypesAndValues::Addr__Union addr;
  addr.nameAddr() = name_addr;
  p_to_header.addressField() = addr;
  // Params
  OPTIONAL<LibSip__Common::SemicolonParam__List> params;
+9 −4
Original line number Diff line number Diff line
@@ -54,12 +54,13 @@ private: //! \todo Move this section into a sip_codec_helper class, need to deco
  int encode_request_headers(const LibSip__SIPTypesAndValues::MessageHeader& p_msg_header, osip_message_t* p_sip_message);
  int encode_request_message_body(const LibSip__MessageBodyTypes::MessageBody& p_message_body, osip_message_t* p_sip_message);
  int encode_request_payload(const LibSip__SIPTypesAndValues::Payload& p_payload, osip_message_t* p_sip_message);
  int encode_from_header(const LibSip__SIPTypesAndValues::From& p_from, osip_from_t* p_from_header);
  int encode_to_header(const LibSip__SIPTypesAndValues::To& p_to, osip_to_t* p_to_header);
  int encode_via_header(const LibSip__SIPTypesAndValues::Via& p_via, osip_via_t* p_via_header);
  int encode_from_header(const LibSip__SIPTypesAndValues::From& p_from, osip_from_t** p_from_header);
  int encode_max_forwards_header(const  OPTIONAL<LibSip__SIPTypesAndValues::MaxForwards>& p_max_forwards, osip_message_t** p_sip_message);
  int encode_supported_header(const  OPTIONAL<LibSip__SIPTypesAndValues::Supported>& p_supported, osip_message_t** p_sip_message);
  int encode_to_header(const LibSip__SIPTypesAndValues::To& p_to, osip_to_t** p_to_header);
  int encode_via_header(const LibSip__SIPTypesAndValues::Via& p_via, osip_via_t** p_via_header);

  int encode_sip_url(const LibSip__SIPTypesAndValues::SipUrl& p_sip_uri, osip_uri_t** p_uri);
  void encode_host_port(const LibSip__SIPTypesAndValues::HostPort& p_host_port, std::string& p_host, std::string& p_port);

private: //! \todo Move this section into a sip_codec_helper class, need to decode Response too
  void decode_message_body(const osip_message_t* p_sip_message, LibSip__SIPTypesAndValues::Request& p_request);
@@ -88,9 +89,13 @@ private: //! \todo Move this section into a sip_codec_helper class, need to deco
  void decode_to_header(const osip_to_t* p_sip_to, LibSip__SIPTypesAndValues::To& p_to_header);
  void decode_via_header(const osip_message_t* p_sip_via_list, LibSip__SIPTypesAndValues::Via& p_via_header);
  
  void encode_host_port(const LibSip__SIPTypesAndValues::HostPort& p_host_port, std::string& p_host, std::string& p_port);
  void decode_host_port(const char* p_host, const char* p_port, LibSip__SIPTypesAndValues::HostPort& p_host_port);
  int encode_semi_colon_params(const LibSip__Common::SemicolonParam__List& p_list, osip_list_t* p_sip_list);
  void decode_semi_colon_params(const osip_list_t& p_sip_list, OPTIONAL<LibSip__Common::SemicolonParam__List>& p_list);
  int encode_ampersand_params(const LibSip__Common::AmpersandParam__List& p_list, osip_list_t** p_sip_list);
  void decode_ampersand_params(const osip_list_t& p_sip_list, OPTIONAL<LibSip__Common::AmpersandParam__List>& p_list);
  int encode_option_tag_list(const LibSip__SIPTypesAndValues::OptionTag__List& p_options_tags, osip_message_t** p_sip_message);
  void decode_option_tag_list(const char* p_list, OPTIONAL<LibSip__SIPTypesAndValues::OptionTag__List>& p_options_tags);

}; // End of class sip_codec_request
+2 −2
Original line number Diff line number Diff line
@@ -53,8 +53,8 @@ system.httpPort.params := "HTTP(codecs=held:held_codec;html:html_codec;json:json

[EXECUTE]
# In this section you can specify what parts of your test suite you want to execute.
#TestCodec_Register.tc_register_request_1
TestCodec_Register.tc_register_request_2
TestCodec_Register.tc_register_request_1
#TestCodec_Register.tc_register_request_2
#TestCodec_Register.tc_invite_request_2
#TestCodec_Register.tc_invite_request_2
#TestCodec_HttpRequest.tc_http_get_1
+1 −0
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ do
        cp ${SRC_EMCOM_PATH}/ttcn/patch_lib_http/*.ttcn ${TTCN_3_DST_PATH}/$i/ttcn
    elif [ "$i" == "LibCommon" ]
    then
        cp ${TTCN_3_ORG_PATH}/$i/ttcn/*.ttcn ${TTCN_3_DST_PATH}/$i/ttcn
        # Patch TITAN due to issues in xsd2ttcn
        cp ${SRC_EMCOM_PATH}/ttcn/patch_lib_common_titan/*.ttcn ${TTCN_3_DST_PATH}/$i/ttcn
    fi
+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ module AtsNg112_TestCases {
            var Presence v_presence;
            var Tuple v_tuple;
            var Geopriv v_geopriv;
            var PointProperty v_point;
            var Point v_point;
            var universal charstring v_temp;
            var integer v_result;
            
Loading