Obtaining a List of Features with the License Manager

Declare Variables/Constants

#define  CONTACT_SERVER                 "localhost"
#define  MAX_FEATURE_INFO_SCOPE_LENGTH  500

char pcScopeFeatureInfo[MAX_FEATURE_INFO_SCOPE_LENGTH];

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

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_new(&pAttrAppContext);
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.

Note

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