Version


CTA_INIT_PARMS tcapInitparms = {0};
CTA_SERVICE_NAME tcapServiceNames[] = {{"TCAP", "TCAPMGR"}};
tcapInitparms.size = sizeof(CTA_INIT_PARMS);
tcapInitparms.traceflags = CTA_TRACE_ENABLE;
tcapInitparms.parmflags = CTA_PARM_MGMT_SHARED;
tcapInitparms.ctacompatlevel = CTA_COMPATLEVEL;
Ret = ctaInitialize(tcapServiceNames, 1, &tcapInitparms);
if (Ret != SUCCESS) {
printf("ERROR code 0x%08x initializing CT Access.", Ret);
exit( 1 );
}

CTAHD ctaHd; /* CTA context handle */
CTAQUEUEHD ctaQueue; /* Queue */
Ret = ctaCreateQueue( NULL, 0, &ctaQueue );
if ( Ret != SUCCESS )
{
ctaGetText( NULL_CTAHD, Ret, sErr, sizeof( sErr ) );
printf( "*ERROR : ctaCreateQueue failed( %s )\n", sErr );
}
sprintf( contextName, "TcapSAP-%d", spId ); /* context name is optional */
Ret = ctaCreateContext( ctaQueue, spId, contextName, &ctaHd );
if ( Ret != SUCCESS )
{
ctaGetText( NULL_CTAHD, Ret, sErr, sizeof( sErr ) );
printf( "ERROR : ctaCreateContext failed( %s )\n", sErr );
ctaDestroyQueue( pSap->ctaQueue );
}

CTA_SERVICE_DESC TCAPOpenSvcLst[] = {{{"TCAP", "TCAPMGR"}, {0}, {0}, {0}}};
tcapOpenSvcLst[0].svcargs.args[0] = boardNum; /* board number */
tcapOpenSvcLst[0].svcargs.args[1] = DPRCHAN + sapid; /* srcEnt */
tcapOpenSvcLst[0].svcargs.args[2] = ZERO; /* srcInst */
tcapOpenSvcLst[0].svcargs.args[3] = SUID; /* suId */
tcapOpenSvcLst[0].svcargs.args[4] = sapid; /* spId */
tcapOpenSvcLst[0].svcargs.args[5] = ssn; /* ssn */
tcapOpenSvcLst[0].svcargs.args[6] = 256;
/* increase API queue size */

ret = ctaWaitEvent( ctaQueue, &event, CTA_WAIT_FOREVER );
if ( ret != SUCCESS )
/* handle the error */
else
{
switch ( event.id )
{
case TCAPEVN_DATA:
/* an TCAP date event has occured, call TCAPRetrieveMessage()
to retrieve the message and proccess it */
tcret = TCAPRetrieveMessage( ctaHd, &msg, &infoBlk );
if( ret == TCAP_SUCCESS )
/* process received TCAP event */
else if( ret == TCAP_NOMSG
/* this is normal - just ignore and wait for next event */
else
/* TCAPRetrieveMessage failed - handle the error */
break;
case TCAPEVN_CONGEST:
/* TCAP layer or API is congested or congestion abated;
take appropriate action */
cong_lvl = (U8) event.value;
if( cong_lvl == 0 )
/* congestion abated - restore traffic to normal levels */
else
/* congestion now at level "cong_lvl" - take appropriate
action to reduce traffic. */
break;
.
.
.
}
}








[ctasys] Service = tcap, tcapmgr
tcapInitparms.size = sizeof(CTA_INIT_PARMS);
tcapInitparms.traceflags = CTA_TRACE_ENABLE;
tcapInitparms.parmflags = CTA_PARM_MGMT_SHARED;
tcapInitparms.ctacompatlevel = CTA_COMPATLEVEL;
Ret = ctaInitialize(tcapServiceNames, 1, &tcapInitparms);
if (Ret != SUCCESS) {
printf("ERROR code 0x%08x initializing CT Access.", Ret);
exit( 1 );
}
Version