Obtaining a List of Features with the License Manager

Declare Variables/Constants

#define  CONTACT_SERVER                 "localhost"


static const char* pcScopeFeatureInfoPart1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
					      "<feature index=\"";
static const char* pcScopeFeatureInfoPart2 = "\"><name></name>"

sntl_licensing_attr_t* pAttrAppContext = NULL;
sntl_licensing_app_context_t* pAppContext = NULL;
char* pcFeatureInfo = NULL;
int  iRetCode = SNTL_SUCCESS;
int  iFeatureIndex = 0;

API Calls

To obtain features list, execute the APIs in the specified sequential order only:

sntl_licensing_attr_set_appcontext_contact_server (pAttrAppContext, CONTACT_SERVER);

NOTE   If instead the LSFORCEHOST or LSHOST environment variables are set, then the above-mentioned steps are not required.

sntl_licensing_app_context_new(0, pAttrAppContext, &pAppContext);

>Now call sntl_licensing_get_info inside a while loop (incrementing the feature index, iFeatureIndex at each iteration, its initial value being 0), till the return code is SNTL_NO_MORE_FEATURES, as shown in the code snippet below:

while(iRetCode != SNTL_NO_MORE_FEATURES)
        memset(pcScopeFeatureInfo, 0, MAX_FEATURE_INFO_SCOPE_LENGTH);
        sprintf(pcScopeFeatureInfo, "%s%d%s", 
              pcScopeFeatureInfoPart1, iFeatureIndex++, pcScopeFeatureInfoPart2);

        iRetCode = sntl_licensing_get_info(pAppContext, pcScopeFeatureInfo, 
                                           SNTL_QUERY_FEATURE_INFO_VERSION(v), &pcFeatureInfo);
	/* Parse the XML output contained in pcFeatureInfo */
    }    /*end of while loop*/

On success during each iteration of the while loop, the pcFeatureInfo parameter contains an XML-based output having the detailed information (an example has been shown here) for the feature at that index.


Refer to the C sample of the Unified API (installed in the Sentinel RMS SDK) for a specific API function, its parameters, and usage.