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

Function set_dst_uri

parser/msg_parser.c:1052–1081  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1050 * Make a private copy of the string and assign it to dst_uri
1051 */
1052int set_dst_uri(struct sip_msg *msg, str *uri)
1053{
1054 if (!msg || !uri) {
1055 LM_ERR("invalid parameter value\n");
1056 return -1;
1057 }
1058
1059 /* strange/corrupt input: best to assume it's an empty URI */
1060 if (!uri->s || uri->len == 0) {
1061 pkg_free(msg->dst_uri.s);
1062 memset(&msg->dst_uri, 0, sizeof msg->dst_uri);
1063 return 0;
1064 }
1065
1066 if (msg->dst_uri.s && (msg->dst_uri.len >= uri->len)) {
1067 memcpy(msg->dst_uri.s, uri->s, uri->len);
1068 msg->dst_uri.len = uri->len;
1069 } else {
1070 msg->dst_uri.s = pkg_realloc(msg->dst_uri.s, uri->len);
1071 if (!msg->dst_uri.s) {
1072 LM_ERR("not enough pkg memory\n");
1073 return -1;
1074 }
1075
1076 memcpy(msg->dst_uri.s, uri->s, uri->len);
1077 msg->dst_uri.len = uri->len;
1078 }
1079
1080 return 0;
1081}
1082
1083void reset_dst_uri(struct sip_msg *msg)
1084{

Callers 15

next_branchesFunction · 0.85
w_setdsturiFunction · 0.85
pv_set_dsturiFunction · 0.85
_branch_2_msgFunction · 0.85
msg_set_dst_uriFunction · 0.85
ds_update_dstFunction · 0.85
lb_routeFunction · 0.85
topo_no_dlg_seq_handlingFunction · 0.85
restore_nated_ruri_fFunction · 0.85
dp_apply_policyFunction · 0.85
path_rr_callbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected