Before calling any TCAP service functions, the application must:
Refer to the Natural Access Developer's Reference Manual for information about Natural Access.
The Natural Access environment is initialized by calling ctaInitialize. Initialize Natural Access only once per application, regardless of the number of queues and contexts created.
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 );
}
The application creates the required Natural Access queues and contexts. The queue must always be created before any associated context is created.
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 );
...
}
Once the queues and contexts are created, the application must bind to each desired TCAP user service access point by calling ctaOpenServices once for each binding. The binding operation specifies the following parameters:
Parameter |
Description |
board |
TX board number. |
srcEnt |
Calling application entity ID. |
srcInst |
Calling application instance ID. |
suId |
Calling application service user ID. |
spId |
TCAP service access point ID on which to bind. |
ssn |
TCAP subsystem number associated with the service access point. |
API queue size |
Maximum number of requests that can be queued to the board within the TCAP service. Valid range is 128 to 1024. Default = 128. |
In Natural Access, these parameters are specified in the CTA_SERVICE_ARGS structure, contained in the CTA_SERVICE_DESC structure. An example of the parameter specification is provided:
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 */
ctaOpenServices is an asynchronous function. The return from the function indicates that the bind operation initiated. Once completed, a CTAEVN_OPEN_SERVICES_DONE event is returned to the application.
Note: Only a single thread should call ctaOpenServices to open the TCAP service for a single board. All messages generated by the TCAP task on a single board are reported to the last thread to call ctaOpenServices for the TCAP service.