Coding a Commuter License

Declare Variables/Constants

#define FEATURE_NAME           "FeatureCommuter"
#define CONTACT_SERVER         "localhost"

sntl_licensing_attr_t *pAttrAppContext = NULL;
sntl_licensing_app_context_t *pAppContext = NULL;
static const char *pcScopeRecipientInfo = "<?xmlversion=\"1.0\"encoding=\"UTF-8\"?>"
					   "<sentinelScope>"                                               
"<lockSelector>0x4</lockSelector>"
"</sentinelScope>"; char* pcRecipientInfo = NULL; char* pcAction ="<commute>" "<featureName>"FEATURE_NAME"</featureName>" "<featureVersion>"FEATURE_VERSION"</featureVersion>" "<duration>1</duration>" "</commute>"; char* pcCommuterLicenseString = NULL;

API Calls

To install a commuter 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,pcScopeRecipientInfo, SNTL_QUERY_RECIPIENT_INFO_VERSION(v), &pcRecipientInfo);
sntl_licensing_transfer(pAppContext, pcAction, NULL, NULL, pcRecipientInfo, &pcCommuterLicenseString);
sntl_licensing_install(pAppContext,pcCommuterLicenseString,NULL, NULL);

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

Notes

>Once the commuter license is installed successfully using sntl_licensing_install, it can be requested in the similar way as any license is requested in standalone licensing environment (see Coding a Standard License Authorization/Request).

>The SNTL_QUERY_RECIPIENT_INFO_VERSION(v) constant is defined in the licensing.h header file.

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