You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

The LMX_GetLicenseInfo function retrieves license information from one or more license servers or from a local path.

Prototype

LMX_STATUS LMX_GetLicenseInfo
(
   LMX_HANDLE LmxHandle,
   LMX_LICENSE_INFO **ppLicenseInfo
);

Parameters

LmxHandle
[in/out] LM-X handle.

ppLicenseInfo
[out] Address of LMX_LICENSE_INFO structure pointer.

Return values

On success, this function returns the status code LMX_SUCCESS.

On failure, this function returns an error code in the format described in Return codes.

Remarks

This function is used to retrieve information about both network and local licenses. This function will query one or more license servers to determine the server's status and other license information, and retrieve license information from local paths (a local .lic file or all .lic files in a specified local directory).

This function uses the existing license path set by users through environment variables LMX_LICENSE_PATH, VENDOR_LICENSE_PATH and custom license paths to query each license server and/or local machine (see Controlling license behavior for more information on environment variables). Furthermore, this function takes into account whether automatic server discovery is enabled, which affects queries to license servers.

Note: You should call this function only once, because it can take several seconds to complete depending on the number of license servers being queried.

Queries can be used to understand license usage, check whether licenses are available prior to license checkout, and determine whether borrow, grace or trial licenses are currently checked out. The same method is used by both the LM-X End-User Utility and LM-X End-user Configuration Tool to show who is currently using the licenses on a particular server.

All information in the output data is organized as linked lists. The structures are carefully described in lmx.h, as follows:

Name

Description

LMX_LICENSE_INFO

Holds information about a particular license server or local license file, including information for borrow, grace and trial licenses.

LMX_FEATURE_INFO

Holds information about a particular feature present on a license server or local license, including information for borrow, grace and trial licenses.

LMX_CLIENT_USER

Holds information about a particular user logged onto a license server. (Applies only to network licenses.)

LMX_CLIENT_LEASE

Holds information about a particular license lease done by a specific user. (Applies only to network licenses.)

LMX_CLIENT_QUEUE

Holds information about a particular license queue request done by a specific user. (Applies only to network licenses.)

To enable cycling through objects in a list, each structure contains a pointer named pNext, which identifies the next record. The last record is identified by pNext being NULL.

Example

You can use the following code to extract information about available licenses, their paths, ports, types and list all their features.

#include <lmx.h>
#include <stdio.h>

LMX_HANDLE h;

int main() 
{
  LMX_STATUS s; 
  LMX_LICENSE_INFO *pLicenseInfo;
  LMX_FEATURE_INFO *pFI;

  exit_on_error(LMX_Init(&h));
  if ((s = LMX_GetLicenseInfo(h, &pLicenseInfo)) != LMX_SUCCESS)
     exit_on_error(s);
  for (; pLicenseInfo != NULL; pLicenseInfo = pLicenseInfo->pNext)
  {
    printf("LicencePath : %s\n", pLicenseInfo->szPath);
    printf("Port : %d\n", pLicenseInfo->nPort);
    printf("Type : ");
    if (pLicenseInfo->eLicenseType == LMX_TYPE_LOCAL)
      printf("Locale\n");
    else if (pLicenseInfo->eLicenseType == LMX_TYPE_NETWORK)
      printf("Network\n");
    printf("Features:\n\n");
    for (pFI = pLicenseInfo->pFeature; pFI != NULL; pFI = pFI->pNext)
    {
      printf("FeatureName : %s\n", pFI->szFeatureName);
      printf("VendorName : %s\n", pFI->szVendorName);
    }
  }
  return 0;
}

For a more complete example of using these structures, see the sample files included in the LM-X distribution.

All memory used by these structures is handled and maintained by LM-X. It is assumed to be valid until a new request to LMX_GetLicenseInfo is made.

This function is currently available for use only with C, C++ (excluding Java) and .NET.

  • No labels