You are here: SwitchKit® Development Environment - TCAP Interface User’s Guide > 4 SKIM Sample Application > Step Four: Receiving a TCAP Transaction
Step Four: Receiving a TCAP Transaction
The API function described in this section allows you to receive a TCAP transaction. Transactions are received via transaction handler and registered during initialization. Sample implementation for transaction handler is shown in the following code excerpt.
int APP_TransHandler( SKIM_Trans &trans, void *tag)
{
SKIM_OCTET type;
printf("APP_TransHandler Called\n");
SKIM_UINT id;
trans.GetCallReferenceId(id);
trans.GetTransType(type);
switch(type)
{
case SKIM_TC_UNI:
rcvd_callrefid = id;
printf ("Received TCAP UNI call reference id is %x\n", id);
AppReceiveOperation(trans);
break;
case SKIM_TC_BEGIN :
rcvd_callrefid = id;
printf ("Received TCAP Begin call reference id is %x\n", id);
AppReceiveOperation(trans);
break;
case SKIM_TC_CONTINUE :
rcvd_callrefid = id;
printf ("Received TCAP Continue call reference id is %x\n", id);
AppReceiveOperation (trans);
break;
case SKIM_TC_END :
rcvd_callrefid = id;
printf ("Received TCAP End call reference id is %x\n", id);
AppReceiveOperation (trans);
break;
#if defined(ANSI)
case SKIM_TC_ABORT :
rcvd_callrefid = id;
printf ("Received TCAP Abort call reference id is %x\n", id);
break;
#endif
#if defined(CCITT)
case SKIM_TC_U_ABORT :
rcvd_callrefid = id;
printf ("Received TCAP Abort call reference id is %x\n", id);
break;
case SKIM_TC_P_ABORT :
rcvd_callrefid = id;
printf ("Received TCAP Abort call reference id is %x\n", id);
break;
case SKIM_TC_P_ABORT :
rcvd_callrefid = id;
printf ("Received TCAP Abort call reference id is %x\n", id);
break;
#endif
default :
printf("Unknown transaction received\n");
break;
};
return SKIM_SUCCESS;
}
AppReceiveOperation(SKIM_Trans &trans)
{
SKIM_Operation op;
while (trans.RemoveOperation(op) == SKIM_SUCCESS)
{
if (op.GetType() == SKIM_TC_INVOKE)
{
rcvd_invoke_id = op.GetInvokeId();
printf("Received Invoke with Invoke id = %d\n",
op.GetInvokeId());
vector<byte> paramData;
op.GetParameter(paramData);
SKIM_Decode(paramData);
}
else if (op.GetType() == SKIM_TC_RESULT_L)
{
printf("Received Return Result Last with Invoke id = %d\n",
op.GetInvokeId());
vector<byte> paramData;
op.GetParameter(paramData);
SKIM_DecodeResponse(paramData);
}
#if defined(ANSI)
else if (op.GetType() == SKIM_TC_ERROR)
{
printf("Received Return Error with Invoke id = %d\n",
op.GetInvokeId());
}
#endif
#if defined(CCITT)
else if (op.GetType() == SKIM_TC_U_ERROR)
{
printf("Received Return Error Last with Invoke id = %d\n",
op.GetInvokeId());
}
#endif
#if defined(ANSI)
else if (op.GetType() == SKIM_TC_REJECT)
{
printf("Received Return Reject with Invoke id = %d\n",
op.GetInvokeId());
}
#endif
#if defined(CCITT)
else if (op.GetType() == SKIM_TC_U_REJECT ||
op.GetType() == SKIM_TC_L_REJECT ||
op.GetType() == SKIM_TC_R_REJECT)
{
printf("Received Return Error Last with Invoke id = %d\n",
op.GetInvokeId());
}
#endif
else
{
printf("Unknown operation type received\n");
}
}
}