MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / set_ruri

Function set_ruri

parser/msg_parser.c:1014–1045  ·  view source on GitHub ↗

* Make a private copy of the string and assign it to new_uri */

Source from the content-addressed store, hash-verified

1012 * Make a private copy of the string and assign it to new_uri
1013 */
1014int set_ruri(struct sip_msg *msg, str *uri)
1015{
1016 if (!msg || !uri) {
1017 LM_ERR("invalid parameter value\n");
1018 return -1;
1019 }
1020
1021 /* strange/corrupt input: best to assume it's an empty URI */
1022 if (!uri->s || uri->len == 0) {
1023 pkg_free(msg->new_uri.s);
1024 memset(&msg->new_uri, 0, sizeof msg->new_uri);
1025 return 0;
1026 }
1027
1028 if (msg->new_uri.s && (msg->new_uri.len >= uri->len)) {
1029 memcpy(msg->new_uri.s, uri->s, uri->len);
1030 msg->new_uri.len = uri->len;
1031 } else {
1032 msg->new_uri.s = pkg_realloc(msg->new_uri.s, uri->len + 1);
1033 if (!msg->new_uri.s) {
1034 LM_ERR("not enough pkg memory (%d)\n",uri->len);
1035 return -1;
1036 }
1037
1038 memcpy(msg->new_uri.s, uri->s, uri->len);
1039 msg->new_uri.len = uri->len;
1040 }
1041
1042 set_ruri_q(msg, Q_UNSPECIFIED);
1043 msg->parsed_uri_ok = 0;
1044 return 0;
1045}
1046
1047
1048

Callers 15

next_branchesFunction · 0.85
w_seturiFunction · 0.85
pv_set_ruriFunction · 0.85
_branch_2_msgFunction · 0.85
msg_rewrite_ruriFunction · 0.85
set_alias_to_ruriFunction · 0.85
topo_no_dlg_seq_handlingFunction · 0.85
ruri_del_paramFunction · 0.85
ruri_add_paramFunction · 0.85
ruri_tel2sipFunction · 0.85
sd_lookupFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_lookupFunction · 0.68