Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 See "Controlling license behavior" on page 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 and LM-X Config 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:

...

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.

For example, you can use the following code to cycle through multiple license paths and list all their features:

LMX_STATUS LmxStat;  
LMX_LICENSE_INFO *pLicenseInfo;
LMX_FEATURE_INFO *pFI;
if ((LmxStat = LMX_GetLicenseInfo(LmxHandle, &pLicenseInfo)) != LMX_SUCCESS)
{

...

  printf("Error: %s\n", LMX_GetErrorMessageSimple(LmxStat)); 
/* Quit early due to error. */
}
for (; pLicenseInfo != NULL; pLicenseInfo = pLicenseInfo->pNext)
{

...

  for (pFI = pLicenseInfo->pFeature; pFI != NULL; pFI = pFI->pNext)

...

  { 

...

  }
}

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.