Beispiel #1
0
void destroy_tmcb_lists(void)
{
	if (!req_in_tmcb_hl)
		return;

	empty_tmcb_list(req_in_tmcb_hl);

	shm_free(req_in_tmcb_hl);
}
Beispiel #2
0
/* register a callback function 'f' for 'types' mask of events;
 * will be called back whenever one of the events occurs in transaction module
 * (global or per transaction, depending of event type)
*/
int register_tmcb( struct sip_msg* p_msg, struct cell *t, int types,
				  transaction_cb f, void *param, release_tmcb_param release_func )
{
	struct tmcb_head_list *cb_list;

	/* are the callback types valid?... */
	if ( types<0 || types>TMCB_MAX ) {
		LM_CRIT("invalid callback types: mask=%d\n",
			types);
		return E_BUG;
	}
	/* we don't register null functions */
	if (f==0) {
		LM_CRIT("null callback function\n");
		return E_BUG;
	}

	if (types&TMCB_REQUEST_IN) {
		if (types!=TMCB_REQUEST_IN) {
			LM_CRIT("callback type TMCB_REQUEST_IN "
				"can't be register along with types\n");
			return E_BUG;
		}
		if (req_in_tmcb_hl==0) {
			LM_ERR("callback type TMCB_REQUEST_IN "
				"registration attempt before TM module initialization\n");
			return E_CFG;
		}
		cb_list = req_in_tmcb_hl;
	} else {
		if (!t) {
			if (!p_msg) {
				LM_CRIT("no sip_msg, nor transaction given\n");
				return E_BUG;
			}
			/* look for the transaction */
			t = get_t();
			if ( t!=NULL && t!=T_UNDEFINED ){
				cb_list = &(t->tmcb_hl);
			} else {
				/* no transaction found -> link it to waitting list */
				if (p_msg->id!=tmcb_pending_id) {
					empty_tmcb_list(&tmcb_pending_hl);
					tmcb_pending_id = p_msg->id;
				}
				cb_list = &(tmcb_pending_hl);
			}
		} else {
			cb_list = &(t->tmcb_hl);
		}
	}

	return insert_tmcb( cb_list, types, f, param, release_func );
}
Beispiel #3
0
static int do_t_cleanup( struct sip_msg *foo, void *bar)
{
	struct cell *t;

	empty_tmcb_list(&tmcb_pending_hl);

	t = get_cancelled_t();
	if (t!=NULL && t!=T_UNDEFINED)
		t_unref_cell(t);

	t = get_e2eack_t();
	if (t!=NULL && t!=T_UNDEFINED)
		t_unref_cell(t);

	reset_e2eack_t();

	return t_unref(foo) == 0 ? SCB_DROP_MSG : SCB_RUN_ALL;
}