Returns the parameter IDs and service ID for the named service and service manager that are available on a particular Natural Access Server.
DWORD ctaGetParmIdsEx ( CTAHD ctahd, char *svcname, char *svcmgrname, unsigned *retsvcid, unsigned *buffer, unsigned maxsize, unsigned *retsize)
Argument |
Description |
ctahd |
Context handle that specifies the server on which commands are executed. ctahd can be a void context handle. |
svcname |
Pointer to the name of the service for which parameter IDs and service IDs are requested. |
svcmgrname |
Pointer to the associated service manager name (optional). |
retsvcid |
Pointer to the returned service ID or NULL. |
buffer |
Pointer to the returned array of parameter IDs. |
maxsize |
Number of available entries in the buffer. |
retsize |
Pointer to the returned value of the number of entries used in the buffer. |
Return value |
Description |
SUCCESS |
|
CTAERR_BAD_ARGUMENT |
svcname, buffer, or retsize is NULL. |
CTAERR_BAD_SIZE |
Size of the buffer is too small. |
CTAERR_NOT_FOUND |
Service is not available to the Natural Access server. |
CTAERR_SVR_COMM |
Application is unable to communicate with the server. |
ctaGetParmIdsEx retrieves all defined parameter IDs for a given named service. There can be different service managers associated with a service interface, and it is optional whether you specify the associated service manager.
The parameter IDs are defined in the various service-specific header files of Natural Access.
If retsvcid is not NULL, the service ID value for the named service is returned.
The service names passed to ctaGetParmIdsEx must display in the list of services known to the specified Natural Access server. The list of services is included in the [ctasys] section of the Natural Access configuration file, cta.cfg. Use ctahd to indicate which Natural Access server to process this command.
ctahd can be a void context handle. A void context handle refers only to the server on which the commands are executed and not to any real context object. Each server has a unique void context handle. If the void context handle is equal to NULL_CTAHD, it refers to the default server.
Refer to Managing parameters for more information.
ctaGetEventSources, ctaGetParmIds, ctaGetParmInfo, ctaGetParms, ctaLoadParameterFile, ctaRefreshParms, ctaSetEventSources
static CTA_SERVICE_DESC pServicesWithNcc[] = /* for ctaOpenServices */
{ { {"ADI", NULL}, { 0 }, { 0 }, { 0 } },
{ {"NCC", NULL}, { 0 }, { 0 }, { 0 } },
{ {"SWI", "SWIMGR"}, { 0 }, { 0 }, { 0 } },
{ {"VCE", "VCEMGR"}, { 0 }, { 0 }, { 0 } }
};
static CTA_SERVICE_DESC* pServices = pServicesWithNcc;
static unsigned SizeofServices = sizeof(pServicesWithNcc);
void ShowDefaultParm( CTAHD ctahd, char *name )
{
CTAHD voidHandle;
unsigned i;
unsigned ret;
CTA_PARM_INFO info;
unsigned i, j;
/* Get the void context handle for the remote Natural Access
* server running on host NMS001
*/
ctaCreateContext( NULL_CTAQUEUEHD, 0, "//NMS001", &voidHandle );
for( i = 0; i < SizeofServices/sizeof(CTA_SERVICE_DESC); i++)
{
unsigned ids[100];
unsigned numids = 0;
unsigned serviceID = 0;
ctaGetParmIdsEx( voidHandle,
pServices[i].name.svcname,
pServices[i].name.svcmgrname,
&serviceID,
ids, 100, &numids );
for (j=0; j < numids; j++)
{
/* Display each of the parameter structure names */
ctaGetParmInfoEx( ctahd, ids[j], NULL, 0, &info );
printf( "%s\n", info.structname );
}
}
}