introduce tacp_trans_set_state() as wrapper to set transaction state
This commit is contained in:
parent
5e130bfada
commit
a64f6ccfff
|
@ -164,7 +164,7 @@ int tcap_csl_tc_begin_req(struct tcap_dialogue *td, OBJECT_IDENTIFIER_t *app_ctx
|
|||
/* TR-BEGIN-REQ to TSL */
|
||||
rc = tcap_tco_tr_begin_req(&td->trans, &tcm);
|
||||
|
||||
td->trans.state = TCAP_TS_INIT_SENT;
|
||||
tcap_trans_set_state(&td->trans, TCAP_TS_INIT_SENT);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -277,13 +277,15 @@ int tcap_csl_tr_begin_ind(struct tcap_transaction *tt, struct TCMessage *tcmsg,
|
|||
}
|
||||
/* Assign Dialogue ID */
|
||||
td->dialogue_id = tcap_dialg_id_alloc();
|
||||
|
||||
tcap_trans_set_state(tt, TCAP_TS_INIT_RECV);
|
||||
|
||||
/* TC-BEGIN.ind to TCU */
|
||||
rc = tcap_tcu_begin_ind(td, app_ctx_name, user_info, bgmsg->components ? 1 : 0);
|
||||
if (bgmsg->components) {
|
||||
/* Components to CHA */
|
||||
rc = tcap_cha_proc_components(td, bgmsg->components);
|
||||
}
|
||||
tt->state = TCAP_TS_INIT_RECV;
|
||||
|
||||
if (bgmsg->dialoguePortion && dial_pdu) {
|
||||
/* Release resources of the ber_decode */
|
||||
|
@ -356,7 +358,7 @@ int tcap_csl_tc_cont_req(struct tcap_dialogue *td, OBJECT_IDENTIFIER_t *app_ctx,
|
|||
/* TR-CONTINUE to TSL */
|
||||
rc = tcap_tco_tr_continue_req(&td->trans, &tcm);
|
||||
|
||||
td->trans.state = TCAP_TS_ACTIVE;
|
||||
tcap_trans_set_state(&td->trans, TCAP_TS_ACTIVE);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -589,6 +591,7 @@ err_discard:
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
tcap_trans_set_state(tt, TCAP_TS_ACTIVE);
|
||||
|
||||
/* TC-CONTINUE.ind to TCU */
|
||||
rc = tcap_tcu_cont_ind(td, app_ctx_name, user_info, ctmsg->components ? 1 : 0);
|
||||
|
@ -600,7 +603,6 @@ err_discard:
|
|||
if (rc < 0)
|
||||
return rc;
|
||||
}
|
||||
tt->state = TCAP_TS_ACTIVE;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ uint32_t tcap_dialg_id_alloc(void)
|
|||
while (tcap_dialg_by_dialg_id(dialg_id))
|
||||
dialg_id = dialg_id_ctr++;
|
||||
|
||||
printf("found free Dialogue ID 0x%08x\n", dialg_id);
|
||||
return dialg_id;
|
||||
}
|
||||
|
||||
|
@ -48,11 +49,15 @@ struct tcap_dialogue *tcap_dialg_alloc(uint32_t dialogue_id)
|
|||
INIT_LLIST_HEAD(&td->ism_list);
|
||||
INIT_LLIST_HEAD(&td->pend_comp_list);
|
||||
|
||||
printf("allocated Dialogue with ID 0x%08x\n", dialogue_id);
|
||||
|
||||
return td;
|
||||
}
|
||||
|
||||
void tcap_dialg_free(struct tcap_dialogue *td)
|
||||
{
|
||||
printf("freeing Dialogue with ID 0x%08x\n", td->dialogue_id);
|
||||
|
||||
/* Delete from global list of all dialogues */
|
||||
llist_del(&td->list);
|
||||
/* No need to iterate over pending component list, talloc is hierarchical */
|
||||
|
@ -133,3 +138,10 @@ const char *tcap_inv_state_name(enum tcap_invocation_state is)
|
|||
{
|
||||
return get_value_string(inv_state_name, is);
|
||||
}
|
||||
|
||||
void tcap_trans_set_state(struct tcap_transaction *tt, enum tcap_transaction_state st)
|
||||
{
|
||||
printf("Transaction 0x%08x old_state=%s, new_state=%s\n", tt->tid_local,
|
||||
tcap_trans_state_name(tt->state), tcap_trans_state_name(st));
|
||||
tt->state = st;
|
||||
}
|
||||
|
|
|
@ -211,6 +211,7 @@ struct tcap_transaction *tcap_transaction_by_local_tid(uint32_t tid_local);
|
|||
uint32_t tcap_trans_id_alloc(void);
|
||||
const char *tcap_trans_state_name(enum tcap_transaction_state ts);
|
||||
const char *tcap_inv_state_name(enum tcap_invocation_state is);
|
||||
void tcap_trans_set_state(struct tcap_transaction *tt, enum tcap_transaction_state st);
|
||||
|
||||
|
||||
/* scXp.c */
|
||||
|
|
|
@ -33,7 +33,7 @@ int tcap_tsm_begin_rcvd(struct tcap_transaction *tt, struct TCMessage *tcmsg, st
|
|||
/* FIXME: TR-BEGIN.ind to CSL */
|
||||
rc = tcap_csl_tr_begin_ind(tt, tcmsg, msg);
|
||||
|
||||
tt->state = TCAP_TS_INIT_RECV;
|
||||
tcap_trans_set_state(tt, TCAP_TS_INIT_RECV);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ int tcap_tsm_begin_trans(struct tcap_transaction *tt, struct TCMessage *tcmsg)
|
|||
/* Send N-UNITDATA.req to SCCP / SUA */
|
||||
rc = tcap_scXp_n_unitdata_req(td->se, msg);
|
||||
|
||||
tt->state = TCAP_TS_INIT_SENT;
|
||||
tcap_trans_set_state(tt, TCAP_TS_INIT_SENT);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ int tcap_tsm_continue_trans(struct tcap_transaction *tt, struct TCMessage *tcmsg
|
|||
/* Send N-UNITDATA.req to SCCP / SUA */
|
||||
rc = tcap_scXp_n_unitdata_req(td->se, msg);
|
||||
|
||||
tt->state = new_state;
|
||||
tcap_trans_set_state(tt, new_state);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ int tcap_tsm_end_trans(struct tcap_transaction *tt, struct TCMessage *tcmsg)
|
|||
/* TSM-stopped to TCO */
|
||||
tcap_tco_tsm_stopped_ind(tt);
|
||||
|
||||
tt->state = TCAP_TS_INVALID;
|
||||
tcap_trans_set_state(tt, TCAP_TS_INVALID);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ int tcap_tsm_abort_trans(struct tcap_transaction *tt, struct TCMessage *tcmsg)
|
|||
/* TSM-stopped to TCO */
|
||||
tcap_tco_tsm_stopped_ind(tt);
|
||||
|
||||
tt->state = TCAP_TS_INVALID;
|
||||
tcap_trans_set_state(tt, TCAP_TS_INVALID);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ int tcap_tsm_continue_rcvd(struct tcap_transaction *tt, struct TCMessage *tcmsg,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
tt->state = new_state;
|
||||
tcap_trans_set_state(tt, new_state);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ int tcap_tsm_end_rcvd(struct tcap_transaction *tt, struct TCMessage *tcmsg, stru
|
|||
/* TSM-stopped to TCO */
|
||||
tcap_tco_tsm_stopped_ind(tt);
|
||||
|
||||
tt->state = TCAP_TS_INVALID;
|
||||
tacp_trans_set_state(tt, TCAP_TS_INVALID);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ int tcap_tsm_abort_rcvd(struct tcap_transaction *tt, struct TCMessage *tcmsg, st
|
|||
/* TSM-stopped to TCO */
|
||||
tcap_tco_tsm_stopped_ind(tt);
|
||||
|
||||
tt->state = TCAP_TS_INVALID;
|
||||
tacp_trans_set_state(tt, TCAP_TS_INVALID);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ int tcap_tsm_local_abort(struct tcap_transaction *tt)
|
|||
/* TSM-stopped to TCO */
|
||||
tcap_tco_tsm_stopped_ind(tt);
|
||||
|
||||
tt->state = TCAP_TS_INVALID;
|
||||
tacp_trans_set_state(tt, TCAP_TS_INVALID);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue