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

Function mk_shm_proxy

proxy.c:293–327  ·  view source on GitHub ↗

same as add_proxy, but it doesn't add the proxy to the list * uses also SRV if possible & port==0 (quick hack) works in shared memory */

Source from the content-addressed store, hash-verified

291 * uses also SRV if possible & port==0 (quick hack)
292 works in shared memory */
293struct proxy_l* mk_shm_proxy(str* name, unsigned short port, unsigned short proto,
294 int is_sips)
295{
296 struct proxy_l* p;
297 struct hostent* he;
298
299 p=(struct proxy_l*) shm_malloc(sizeof(struct proxy_l));
300 if (p==0){
301 ser_error=E_OUT_OF_MEM;
302 LM_CRIT("shm memory allocation failure\n");
303 goto error;
304 }
305 memset(p,0,sizeof(struct proxy_l));
306 p->name=*name;
307 p->port=port;
308 p->proto=proto;
309
310 LM_DBG("doing DNS lookup...\n");
311 he = sip_resolvehost(name, &(p->port), &p->proto, is_sips,
312 disable_dns_failover?0:&p->dn );
313 if (he==0){
314 ser_error=E_BAD_ADDRESS;
315 LM_CRIT("could not resolve hostname: \"%.*s\"\n", name->len, name->s);
316 shm_free(p);
317 goto error;
318 }
319 if (hostent_shm_cpy(&(p->host), he)!=0){
320 free_dns_res( p );
321 shm_free(p);
322 goto error;
323 }
324 return p;
325error:
326 return 0;
327}
328
329/* clones a proxy into pkg memory */
330struct proxy_l* clone_proxy(struct proxy_l *sp)

Callers

nothing calls this directly

Calls 5

shm_mallocFunction · 0.85
sip_resolvehostFunction · 0.85
shm_freeFunction · 0.85
hostent_shm_cpyFunction · 0.85
free_dns_resFunction · 0.85

Tested by

no test coverage detected