TC-BEGIN.ind correctly parse the dialogue portion
This commit is contained in:
parent
7648b13cab
commit
fa1cd47182
|
@ -61,7 +61,7 @@ int tcap_csl_tc_uni_req(struct tcap_dialogue *td, OBJECT_IDENTIFIER_t *app_ctx,
|
|||
memcpy(&audt->application_context_name, app_ctx, sizeof(audt->application_context_name));
|
||||
audt->protocol_version = &dial_version1;
|
||||
|
||||
fprintf(stdout, "\nDialogue portion:\n");
|
||||
fprintf(stdout, "\nTC-UNI.req Dialogue portion:\n");
|
||||
xer_fprint(stdout, &asn_DEF_UniDialoguePDU, &dial);
|
||||
|
||||
memset(&ext, 0, sizeof(ext));
|
||||
|
@ -114,7 +114,7 @@ int tcap_csl_tc_begin_req(struct tcap_dialogue *td, OBJECT_IDENTIFIER_t *app_ctx
|
|||
/* Set protocol_version = 1 */
|
||||
aarq->protocol_version = &dial_version1;
|
||||
/* Build AARQ apdu */
|
||||
fprintf(stdout, "\nDialogue portion:\n");
|
||||
fprintf(stdout, "\nTC-BEGIN.req Dialogue portion:\n");
|
||||
xer_fprint(stdout, &asn_DEF_DialoguePDU, &dial);
|
||||
|
||||
memset(&ext, 0, sizeof(ext));
|
||||
|
@ -174,28 +174,55 @@ int tcap_csl_tr_begin_ind(struct tcap_transaction *tt, struct TCMessage *tcmsg,
|
|||
{
|
||||
struct tcap_dialogue *td = dialg_by_trans(tt);
|
||||
struct Begin *bgmsg = &tcmsg->choice.begin;
|
||||
struct DialoguePDU *dial_pdu = NULL;
|
||||
OBJECT_IDENTIFIER_t *app_ctx = NULL;
|
||||
void *user_info;
|
||||
struct user_information *user_info = NULL;
|
||||
int rc = 0;
|
||||
|
||||
if (bgmsg->dialoguePortion) {
|
||||
struct ExternalPDU *ext_pdu = NULL;
|
||||
asn_dec_rval_t adr;
|
||||
struct AARQ_apdu *aarq;
|
||||
/* extract dialogue portion */
|
||||
if (0/* Check for correctness */) {
|
||||
adr = ber_decode(NULL, &asn_DEF_ExternalPDU, &ext_pdu,
|
||||
bgmsg->dialoguePortion->buf,
|
||||
bgmsg->dialoguePortion->size);
|
||||
if (adr.code != RC_OK) {
|
||||
fprintf(stderr, "TC-BEGIN.ind Error parsing Dialogue portion 1\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
adr = ber_decode(NULL, &asn_DEF_DialoguePDU, &dial_pdu,
|
||||
ext_pdu->dialog.buf, ext_pdu->dialog.size);
|
||||
/* Release the External part */
|
||||
asn_DEF_ExternalPDU.free_struct(&asn_DEF_ExternalPDU, ext_pdu, 0);
|
||||
/* Check for correctness */
|
||||
if (adr.code != RC_OK ){ //||
|
||||
//(dial_pdu && dial_pdu->present != DialoguePDU_PR_dialogueRequest)) {
|
||||
fprintf(stderr, "TC-BEGIN.ind Error parsing Dialogue portion\n");
|
||||
/* Build ABORT apdu */
|
||||
/* Discard components */
|
||||
/* TR-U-ABPRT.req to TSL */
|
||||
rc = tcap_tco_tr_u_abort_req(tt, tcmsg);
|
||||
/* Dalogue terminated to CHA */
|
||||
tcap_cha_dialg_term(td);
|
||||
|
||||
return rc;
|
||||
}
|
||||
if (0/* Check version 1 */) {
|
||||
|
||||
fprintf(stdout, "\nTC-BEGIN.ind Dialogue portion:\n");
|
||||
xer_fprint(stdout, &asn_DEF_UniDialoguePDU, dial_pdu);
|
||||
|
||||
aarq = &dial_pdu->choice.dialogueRequest;
|
||||
if (aarq->protocol_version && 0/* Check version 1 */) {
|
||||
/* Build AARE apdu */
|
||||
/* Discard components */
|
||||
/* TR-P-ABPRT.req to TSL */
|
||||
/* Dalogue terminated to CHA */
|
||||
tcap_cha_dialg_term(td);
|
||||
}
|
||||
/* FIXME: Set application context mode */
|
||||
/* Set application context mode */
|
||||
app_ctx = &aarq->application_context_name;
|
||||
user_info = aarq->user_information;
|
||||
}
|
||||
/* Assign Dialogue ID */
|
||||
td->dialogue_id = tcap_dialg_id_alloc();
|
||||
|
@ -207,6 +234,10 @@ int tcap_csl_tr_begin_ind(struct tcap_transaction *tt, struct TCMessage *tcmsg,
|
|||
}
|
||||
tt->state = TCAP_TS_INIT_RECV;
|
||||
|
||||
if (dial_pdu) {
|
||||
/* Release resources of the ber_decode */
|
||||
asn_DEF_DialoguePDU.free_struct(&asn_DEF_DialoguePDU, dial_pdu, 0);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue