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

Function rport_builder

msg_translator.c:268–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266
267
268char* rport_builder(struct sip_msg *msg, unsigned int *rport_len)
269{
270 char* buf, * tmp;
271 int len, tmp_len;
272
273 tmp_len=0;
274 tmp=int2str(msg->rcv.src_port, &tmp_len);
275 len=RPORT_LEN+tmp_len;
276 buf=pkg_malloc(sizeof(char)*(len+1));/* space for null term */
277 if (buf==0){
278 ser_error=E_OUT_OF_MEM;
279 LM_ERR("out of pkg memory\n");
280 return 0;
281 }
282 memcpy(buf, RPORT, RPORT_LEN);
283 memcpy(buf+RPORT_LEN, tmp, tmp_len);
284 buf[len]=0; /*null terminate it*/
285
286 *rport_len=len;
287 return buf;
288}
289
290
291

Callers 3

restore_vias_from_reqFunction · 0.85

Calls 1

int2strFunction · 0.85

Tested by

no test coverage detected