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

Function build_cell

modules/tm/h_table.c:243–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241
242
243struct cell* build_cell( struct sip_msg* p_msg, int full_uas)
244{
245 struct cell* new_cell;
246 int sip_msg_len;
247 struct usr_avp **old;
248 struct tm_callback *cbs, *cbs_tmp;
249 unsigned short set;
250
251 /* allocs a new cell */
252 new_cell = (struct cell*)shm_malloc(sizeof(struct cell) + context_size(CONTEXT_TRAN));
253 if ( !new_cell ) {
254 ser_error=E_OUT_OF_MEM;
255 return NULL;
256 }
257
258 /* filling with 0 */
259 memset( new_cell, 0, sizeof( struct cell ) + context_size(CONTEXT_TRAN));
260
261 /* get timer set id based on the transaction pointer, but
262 * devide by 64 to avoid issues because pointer are 64 bits
263 * aligned */
264 set = ( ((unsigned long)new_cell)>>tm_timer_shift ) % tm_table->timer_sets;
265
266 /* UAS */
267#ifdef EXTRA_DEBUG
268 new_cell->uas.response.retr_timer.tg=TG_RT;
269 new_cell->uas.response.fr_timer.tg=TG_FR;
270#endif
271 new_cell->uas.response.retr_timer.set = set;
272 new_cell->uas.response.fr_timer.set = set;
273 new_cell->uas.response.my_T=new_cell;
274
275 /* dcm: - local generation transactions should not inherit AVPs
276 * - commpletely new message */
277 if(p_msg) {
278 /* move the current avp list to transaction -bogdan */
279 old = set_avp_list( &new_cell->user_avps );
280 new_cell->user_avps = *old;
281 *old = 0;
282
283 /* set now the hash index & label, in case begin callbacks need them
284 * we are now under hash lock, so it's safe - vlad */
285 new_cell->hash_index = p_msg->hash_index;
286 new_cell->label = tm_table->entrys[ new_cell->hash_index].next_label;
287
288 /* move the pending callbacks to transaction -bogdan */
289 if (p_msg->id==tmcb_pending_id) {
290 new_cell->tmcb_hl = tmcb_pending_hl;
291 tmcb_pending_hl.first = 0;
292 }
293 set_t(new_cell);
294
295 /* enter callback, which may potentially want to parse some stuff,
296 * before the request is shmem-ized */
297 if (has_reqin_tmcbs() )
298 run_reqin_callbacks( new_cell, p_msg, p_msg->REQ_METHOD);
299
300 /* clean possible previous added vias/clen header or else they would

Callers 2

t_uacFunction · 0.85
new_tFunction · 0.85

Calls 11

shm_mallocFunction · 0.85
set_avp_listFunction · 0.85
set_tFunction · 0.85
run_reqin_callbacksFunction · 0.85
free_via_clen_lumpFunction · 0.85
sip_msg_clonerFunction · 0.85
init_synonym_idFunction · 0.85
init_cell_lockFunction · 0.85
destroy_avp_listFunction · 0.85
shm_freeFunction · 0.85
reset_avpsFunction · 0.85

Tested by

no test coverage detected