The information on this page refers to LM-X v4.9.1 and newer, which added the szHalPath field to the LMX_LICENSE_INFO structure. If you are using an older version of LM-X, refer to documentation for earlier versions. 

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.

LMX_LICENSE_INFO contains the following fields.

LMX_LICENSE_INFO field

Description

char szPath[LMX_MAX_LONG_STRING_LENGTH+1]

The path and name of the license file (for local licenses) or license server host name (for network licenses).

LMX_STATUS LmxStatThe status of the license path. If this is not LMX_SUCCESS, then all remaining information in LMX_LICENSE_INFO or related structures may be invalid.
char szHalPath[3][LMX_MAX_LONG_STRING_LENGTH+1]

Paths for the 3 HAL servers, in the form of "port@host", where the first element is the master, the second is the first slave, and the third is the second slave.

int nPort

The port number of the license server.

char szVendorName[LMX_MAX_SHORT_STRING_LENGTH+1]

The vendor name.

char szVersion[LMX_MAX_SHORT_STRING_LENGTH+1]

The version of the license server.

int nServerUptimeSeconds

The uptime of the license server.

LMX_FEATURE_INFO *pFeature

Pointers to the features that are present on the license server.

LMX_CLIENT_USER *pUser

Pointers to the users that are present on the license server.

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("Local\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++, and .NET.