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

Function received_builder

msg_translator.c:239–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237
238
239char* received_builder(struct sip_msg *msg, unsigned int *received_len)
240{
241 char *buf, *tmp;
242 int len, tmp_len;
243 struct ip_addr *source_ip;
244
245 source_ip=&msg->rcv.src_ip;
246
247 buf=pkg_malloc(sizeof(char)*MAX_RECEIVED_SIZE);
248 if (buf==0){
249 ser_error=E_OUT_OF_MEM;
250 LM_ERR("out of pkg memory\n");
251 return 0;
252 }
253 memcpy(buf, RECEIVED, RECEIVED_LEN);
254 if ( (tmp=ip_addr2a(source_ip))==0)
255 return 0; /* error*/
256 tmp_len=strlen(tmp);
257 len=RECEIVED_LEN+tmp_len;
258
259 memcpy(buf+RECEIVED_LEN, tmp, tmp_len);
260 buf[len]=0; /*null terminate it */
261
262 *received_len = len;
263 return buf;
264}
265
266
267

Callers 3

restore_vias_from_reqFunction · 0.85

Calls 1

ip_addr2aFunction · 0.85

Tested by

no test coverage detected