correctly look-up the _local_ transaction ID on N-UNITDATA.ind

This commit is contained in:
Harald Welte 2010-07-20 11:41:48 +02:00
parent 9c0a3ef50e
commit dbbf03d986
1 changed files with 12 additions and 10 deletions

View File

@ -48,14 +48,13 @@ int tcap_tco_n_unitdata_ind(struct tcap_transport_entity *se, struct msgb *msg)
struct tcap_transaction *tt;
uint32_t dest_tid;
fprintf(stdout, "N-UNITDATA.ind(%s)\n", hexdump(msg->data, msg->len));
fprintf(stdout, "N-UNITDATA.ind(%s):\n", hexdump(msg->data, msg->len));
rv = ber_decode(NULL, &asn_DEF_TCMessage, (void **) &tcmsg, msg->data, msg->len);
if (rv.code != RC_OK) {
fprintf(stderr, "error during BER_decode() RC=%d consumed=%u\n", rv.code, rv.consumed);
return rc;
}
xer_fprint(stdout, &asn_DEF_TCMessage, tcmsg);
switch (tcmsg->present) {
@ -65,9 +64,8 @@ int tcap_tco_n_unitdata_ind(struct tcap_transport_entity *se, struct msgb *msg)
rc = tcap_csl_tr_uni_ind(tt, tcmsg, msg);
break;
case TCMessage_PR_begin:
tt = tcap_transaction_alloc();
/* Assign local transaction ID */
tt->tid_local = tcap_trans_id_alloc();
tt = tcap_transaction_alloc();
/* FIXME: Is TID == no TID ? */
/* Send BEGIN.recv to TSM */
dialg_by_trans(tt)->transp_ent = se;
@ -75,28 +73,28 @@ int tcap_tco_n_unitdata_ind(struct tcap_transport_entity *se, struct msgb *msg)
break;
case TCMessage_PR_continue:
dest_tid = tid_from_octetstr(&tcmsg->choice.Continue.dtid);
tt = tcap_transaction_by_remote_tid(dest_tid);
tt = tcap_transaction_by_local_tid(dest_tid);
/* FIXME: Check if DTID is assigned */
if (!tt)
return -EIO;
goto out_err_no_tid;
/* Send CONTINUE.recv to TSM */
rc = tcap_tsm_continue_rcvd(tt, tcmsg, msg);
break;
case TCMessage_PR_end:
dest_tid = tid_from_octetstr(&tcmsg->choice.end.dtid);
tt = tcap_transaction_by_remote_tid(dest_tid);
tt = tcap_transaction_by_local_tid(dest_tid);
/* FIXME: Check if DTID is assigned */
if (!tt)
return -EIO;
goto out_err_no_tid;
/* Send END.recv to TSM */
rc = tcap_tsm_end_rcvd(tt, tcmsg, msg);
break;
case TCMessage_PR_abort:
dest_tid = tid_from_octetstr(&tcmsg->choice.abort.dtid);
tt = tcap_transaction_by_remote_tid(dest_tid);
tt = tcap_transaction_by_local_tid(dest_tid);
/* FIXME: Check if DTID is assigned */
if (!tt)
return -EIO;
goto out_err_no_tid;
/* Send ABORT.recv to TSM */
rc = tcap_tsm_abort_rcvd(tt, tcmsg, msg);
break;
@ -109,6 +107,10 @@ int tcap_tco_n_unitdata_ind(struct tcap_transport_entity *se, struct msgb *msg)
asn_DEF_TCMessage.free_struct(&asn_DEF_TCMessage, tcmsg, 0);
return rc;
out_err_no_tid:
fprintf(stderr, "TCMessage for unknown TID 0x%08x\n", dest_tid);
return -EIO;
}
/* N-NOTICE.ind from SCCP / SUA */