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

Function shm_clone_proxy

resolve.h:194–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192
193
194static inline struct proxy_l* shm_clone_proxy(struct proxy_l *sp,
195 unsigned int move_dn)
196{
197 struct proxy_l *dp;
198
199 dp = (struct proxy_l*)shm_malloc(sizeof(struct proxy_l));
200 if (dp==NULL) {
201 LM_ERR("no more shm memory\n");
202 return 0;
203 }
204 memset( dp , 0 , sizeof(struct proxy_l));
205
206 dp->port = sp->port;
207 dp->proto = sp->proto;
208 dp->addr_idx = sp->addr_idx;
209 dp->flags = PROXY_SHM_FLAG;
210
211 /* clone the hostent */
212 if (hostent_shm_cpy( &dp->host, &sp->host)!=0)
213 goto error0;
214
215 /* clone the dns resolver */
216 if (sp->dn) {
217 if (move_dn) {
218 dp->dn = sp->dn;
219 sp->dn = 0;
220 } else {
221 dp->dn = dns_res_copy(sp->dn);
222 if (dp->dn==NULL)
223 goto error1;
224 }
225 }
226
227 return dp;
228error1:
229 free_shm_hostent(&dp->host);
230error0:
231 shm_free(dp);
232 return 0;
233}
234
235
236

Callers 3

run_local_routeFunction · 0.85
t_uacFunction · 0.85
add_uacFunction · 0.85

Calls 5

shm_mallocFunction · 0.85
hostent_shm_cpyFunction · 0.85
dns_res_copyFunction · 0.85
free_shm_hostentFunction · 0.85
shm_freeFunction · 0.85

Tested by

no test coverage detected