Finding the Expiration Date of a License

Declare Variables/Constants

#define FEATURE_NAME           "Feature1"
#define FEATURE_VERSION         "1.0"
#define CONTACT_SERVER         "localhost"

static const char *pcScopeFeatureInfo = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
        "<sentinelScope>"
             "<feature index=\"0\">"                                           

             "<name>"FEATURE_NAME"</name>"

             "<version>"FEATURE_VERSION"</version>"

             "</feature>"

        "</sentinelScope>"; sntl_licensing_attr_t *pAttrAppContext = NULL; sntl_licensing_app_context_t *pAppContext = NULL; char *pcFeatureInfo = NULL;

API Calls

To know the expiration data of a license, execute the APIs in the specified sequential order only:

sntl_licensing_attr_new(&pAttrAppContext);
sntl_licensing_attr_set_appcontext_contact_server (pAttrAppContext, CONTACT_SERVER);
sntl_licensing_app_context_new(0, pAttrAppContext, &pAppContext);
sntl_licensing_get_info(pAppContext, pcScopeFeatureInfo, SNTL_QUERY_FEATURE_INFO_VERSION(v), &pcFeatureInfo);

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

On success, the pcFeatureInfo parameter contains an XML output having the detailed information (an example output is shown here). Parse the XML, the “deathTime” tag in this XML contains the epoch timestamp for the license expiration.

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.