ctaGetParmIds

Returns the parameter IDs and service ID for the named service and service manager.

Prototype

DWORD ctaGetParmIds ( char *svcname, char *svcmgrname, unsigned *retsvcid, unsigned *buffer, unsigned maxsize, unsigned *retsize)

Argument

Description

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 returned service ID or NULL.

buffer

Pointer to 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 values

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 Natural Access.

CTAERR_SVR_COMM

Application is unable to communicate with the server.


Details

ctaGetParmIds 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.

Service names passed to ctaGetParmIds must display in the list of services known to the default Natural Access Server. The list of services is located in the [ctasys] section of the Natural Access configuration file, cta.cfg.

Refer to Managing parameters for more information.

See also

ctaGetEventSources, ctaGetParmIdsEx, ctaGetParmInfo, ctaGetParms, ctaLoadParameterFile, ctaRefreshParms, ctaSetEventSources

Example

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 )
{
    unsigned      i;
    unsigned      ret;
    CTA_PARM_INFO info;

    unsigned i, j;

    for( i = 0; i < SizeofServices/sizeof(CTA_SERVICE_DESC); i++)
    {
        unsigned ids[100];
        unsigned numids = 0;
        unsigned serviceID = 0;

        ctaGetParmIds( 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 );
        }
    }
}