Allocate Transaction ID while allocating Dialogue
This commit is contained in:
parent
dbbf03d986
commit
a6d75256cd
|
@ -170,7 +170,7 @@ int tcap_csl_tc_begin_req(struct tcap_dialogue *td, OBJECT_IDENTIFIER_t *app_ctx
|
||||||
tcm->choice.begin.components = tcap_cha_req_components(td);
|
tcm->choice.begin.components = tcap_cha_req_components(td);
|
||||||
|
|
||||||
/* Assign local transaction ID */
|
/* Assign local transaction ID */
|
||||||
trans_id = ntohl(td->trans.tid_local);
|
trans_id = htonl(td->trans.tid_local);
|
||||||
OCTET_STRING_fromBuf(&tcm->choice.begin.otid,
|
OCTET_STRING_fromBuf(&tcm->choice.begin.otid,
|
||||||
(const char *) &trans_id, sizeof(trans_id));
|
(const char *) &trans_id, sizeof(trans_id));
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,19 @@ int tcap_dialg_comp_add(struct tcap_dialogue *td, Component_t *comp)
|
||||||
ASN_SEQUENCE_ADD(&td->pend_comp->list, comp);
|
ASN_SEQUENCE_ADD(&td->pend_comp->list, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t tcap_trans_id_alloc(void)
|
||||||
|
{
|
||||||
|
uint32_t trans_id;
|
||||||
|
|
||||||
|
trans_id = trans_id_ctr++;
|
||||||
|
|
||||||
|
while (tcap_transaction_by_local_tid(trans_id))
|
||||||
|
trans_id = trans_id_ctr++;
|
||||||
|
|
||||||
|
printf("Allocating local Transaction ID 0x%08x\n", trans_id);
|
||||||
|
return trans_id;
|
||||||
|
}
|
||||||
|
|
||||||
struct tcap_dialogue *tcap_dialg_alloc(uint32_t dialogue_id)
|
struct tcap_dialogue *tcap_dialg_alloc(uint32_t dialogue_id)
|
||||||
{
|
{
|
||||||
struct tcap_dialogue *td = talloc_zero(tall_tcap_dialg_ctx, struct tcap_dialogue);
|
struct tcap_dialogue *td = talloc_zero(tall_tcap_dialg_ctx, struct tcap_dialogue);
|
||||||
|
@ -118,6 +131,7 @@ struct tcap_transaction *tcap_transaction_by_remote_tid(uint32_t tid_remote)
|
||||||
{
|
{
|
||||||
struct tcap_dialogue *td;
|
struct tcap_dialogue *td;
|
||||||
|
|
||||||
|
printf("transaction_by_remote_tid(cur=0x%08x, request=0x%08x)\n", td->trans.tid_local, tid_remote);
|
||||||
llist_for_each_entry(td, &tcap_dialogues, list) {
|
llist_for_each_entry(td, &tcap_dialogues, list) {
|
||||||
if (td->trans.tid_remote == tid_remote)
|
if (td->trans.tid_remote == tid_remote)
|
||||||
return &td->trans;
|
return &td->trans;
|
||||||
|
@ -131,6 +145,7 @@ struct tcap_transaction *tcap_transaction_by_local_tid(uint32_t tid_local)
|
||||||
struct tcap_dialogue *td;
|
struct tcap_dialogue *td;
|
||||||
|
|
||||||
llist_for_each_entry(td, &tcap_dialogues, list) {
|
llist_for_each_entry(td, &tcap_dialogues, list) {
|
||||||
|
printf("transaction_by_local_tid(cur=0x%08x, request=0x%08x)\n", td->trans.tid_local, tid_local);
|
||||||
if (td->trans.tid_local == tid_local)
|
if (td->trans.tid_local == tid_local)
|
||||||
return &td->trans;
|
return &td->trans;
|
||||||
}
|
}
|
||||||
|
@ -138,18 +153,6 @@ struct tcap_transaction *tcap_transaction_by_local_tid(uint32_t tid_local)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t tcap_trans_id_alloc(void)
|
|
||||||
{
|
|
||||||
uint32_t trans_id;
|
|
||||||
|
|
||||||
trans_id = trans_id_ctr++;
|
|
||||||
|
|
||||||
while (tcap_transaction_by_local_tid(trans_id))
|
|
||||||
trans_id = trans_id_ctr++;
|
|
||||||
|
|
||||||
return trans_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct value_string trans_state_name[] = {
|
static const struct value_string trans_state_name[] = {
|
||||||
{ TCAP_TS_INVALID, "TS-Invalid" },
|
{ TCAP_TS_INVALID, "TS-Invalid" },
|
||||||
{ TCAP_TS_IDLE, "TS-Idle" },
|
{ TCAP_TS_IDLE, "TS-Idle" },
|
||||||
|
|
|
@ -241,7 +241,6 @@ void tcap_dialg_free(struct tcap_dialogue *td);
|
||||||
struct tcap_transaction *tcap_transaction_alloc(void);
|
struct tcap_transaction *tcap_transaction_alloc(void);
|
||||||
struct tcap_transaction *tcap_transaction_by_remote_tid(uint32_t tid_remote);
|
struct tcap_transaction *tcap_transaction_by_remote_tid(uint32_t tid_remote);
|
||||||
struct tcap_transaction *tcap_transaction_by_local_tid(uint32_t tid_local);
|
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_trans_state_name(enum tcap_transaction_state ts);
|
||||||
const char *tcap_inv_state_name(enum tcap_invocation_state is);
|
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);
|
void tcap_trans_set_state(struct tcap_transaction *tt, enum tcap_transaction_state st);
|
||||||
|
|
|
@ -376,7 +376,6 @@ LIB_EXPORTED int tcap_user_req_comp(enum tcap_primitive prim, struct tcap_compon
|
||||||
switch (prim) {
|
switch (prim) {
|
||||||
case TCAP_PR_TC_INVOKE:
|
case TCAP_PR_TC_INVOKE:
|
||||||
td = tcap_dialg_alloc(tcci->dialg_id);
|
td = tcap_dialg_alloc(tcci->dialg_id);
|
||||||
td->trans.tid_local = tcap_trans_id_alloc();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Reference in New Issue