This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- FlexNet Publisher
- :
- FlexNet Publisher Knowledge Base
- :
- Sample code to get details(License name,checked out date and time,user etc) of license getting check...
Subscribe
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Sample code to get details(License name,checked out date and time,user etc) of license getting checked out
Sample code to get details(License name,checked out date and time,user etc) of license getting checked out
Below is an example of the code that can be added to get the below details
- Checked out date and time
- User who made the checkout
- Number of licenses checked out
- Name of the feature
- Count of available license
- Count of used license
- Type of the feature
(void)lc_set_attr(lm_job, LM_A_LICENSE_DEFAULT, (LM_A_VAL_TYPE)LICPATH);
for (feats = lc_feat_list(lm_job, LM_FLIST_ALL_FILES | LM_FILTERLIST_ALL_FILES, NULL); feats && *feats; feats++)
{
confi = lc_get_config(lm_job, *feats);
if(confi->idptr && confi->idptr->id.data)
printf(" This feature is node-locked \n\n");
else
printf(" The feature is floating \n\n");
if (confi->users)
{
c = (CONFIG *)0;
for (conf = lc_next_conf(lm_job, *feats, &c); conf; conf=lc_next_conf(lm_job, *feats, &c))
{
fi.feat = conf;
if (lc_get_attr(lm_job, LM_A_VD_FEATURE_INFO, (short *)&fi))
{
lc_perror(lm_job, "LM_A_VD_FEATURE_INFO");
}
else
{
total_lic = fi.num_lic;
used_lic = fi.tot_lic_in_use;
aval_lic = total_lic - used_lic;
printf("Total number of licenses are %s = %d \n",feature, total_lic);
printf("Available Count of licenses are %s = %d \n",feature, aval_lic);
}
}
}
else
printf(" This feature is uncounted \n");
printf("##############################\n");
printf ("List of Users for Feature: %s\n",*feats);
printf("##############################\n");
LM_USERS * pUserList = lc_userlist(lm_job, *feats);
while (pUserList)
{
time_t currTime, difftime;
char *sTime = malloc(50 * sizeof(char));
struct tm *localtime(), *currt, *t;
if (strlen(pUserList->name) > 0)
{
int day = 0, hour = 0, minute = 0, second = 0;
currTime = time(0);
printf("User: %s Node: %s Licenses: %d \r\n", pUserList->name, pUserList->node, pUserList->nlic);
t = localtime(&pUserList->time);
printf("Checkout Done At - %02d/%02d %2d:%02d:%02d\n",
t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min,
t->tm_sec);
difftime = (currTime - (pUserList->time));
printf("Checked out from last - %02d days", ((difftime / 86400)));
difftime %= 86400;
printf("% 02d hours", (difftime / 3600));
difftime %= 3600;
printf("% 02d minutes", (difftime / 60));
difftime %= 60;
printf("% 02d seconds\n\n", difftime);
}
pUserList = pUserList->next;
if (pUserList && (!pUserList->name || strlen(pUserList->name) == 0))
pUserList = NULL;
}
}
printf("##############################\n");
printf("press return to exit...");
No ratings