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

Compare with Current View Page History

Version 1 Next »

The LMX_SetOption function sets flags that change licensing behavior prior to license checkout.

Prototype

LMX_STATUS LMX_SetOption
(
LMX_HANDLE LmxHandle,
LMX_SETTINGS eOption,
const void *pSetting
);

Parameters

LmxHandle
[in/out] LM-X handle.
eOption
See the table of LMX_SetOption Options and Settings below.
pSetting
See the table of LMX_SetOption Options and Settings below.
Note: To avoid warnings when using the pSetting parameter, you can typecast it to the type (LMX_OPTION).
The following table describes the eOption and pSetting parameter values for LMX_SetOption, including:

  • See "LMX_OPT_HEARTBEAT_CHECKOUT_SUCCESS_FUNCTION" on page
  • See "LMX_OPT_HEARTBEAT_CHECKOUT_FAILURE_FUNCTION" on page
  • See "LMX_OPT_HEARTBEAT_RETRY_FEATURE_FUNCTION" on page
  • See "LMX_OPT_HEARTBEAT_CONNECTION_LOST_FUNCTION" on page
  • See "LMX_OPT_HEARTBEAT_EXIT_FUNCTION" on page
  • See "LMX_OPT_HEARTBEAT_CALLBACK_VENDORDATA" on page
  • See "LMX_OPT_CUSTOM_HOSTID_FUNCTION" on page
  • See "LMX_OPT_HOSTID_COMPARE_FUNCTION" on page
  • See "LMX_OPT_LICENSE_PATH" on page
  • See "LMX_OPT_LICENSE_STRING" on page
  • See "LMX_OPT_EXACT_VERSION" on page
  • See "LMX_OPT_ALLOW_BORROW" on page
  • See "LMX_OPT_ALLOW_GRACE" on page
  • See "LMX_OPT_TRIAL_DAYS" on page
  • See "LMX_OPT_TRIAL_USES" on page
  • See "LMX_OPT_TRIAL_VIRTUAL_MACHINE" on page
  • See "LMX_OPT_TRIAL_TERMINAL_SERVER" on page
  • See "LMX_OPT_AUTOMATIC_HEARTBEAT_ATTEMPTS" on page
  • See "LMX_OPT_AUTOMATIC_HEARTBEAT_INTERVAL" on page
  • See "LMX_OPT_CUSTOM_SHARE_STRING" on page
  • See "LMX_OPT_SERVERSIDE_REQUEST_STRING" on page
  • See "LMX_OPT_LICENSE_IDLE" on page
  • See "LMX_OPT_CUSTOM_USERNAME" on page
  • See "LMX_OPT_CUSTOM_HOSTNAME" on page
  • See "LMX_OPT_BLACKLIST" on page
  • See "LMX_OPT_ALLOW_MULTIPLE_SERVERS" on page
  • See "LMX_OPT_HOSTID_CACHE_CLEANUP_INTERVAL" on page
  • See "LMX_OPT_RESERVATION_TOKEN" on page
  • See "LMX_OPT_BIND_ADDRESS" on page
  • See "LMX_OPT_HOSTID_ENABLED" on page
  • See "LMX_OPT_HOSTID_DISABLED" on page

Unless otherwise specified, the options in the following table affect the checkout requests.

LMX_SetOption Function eOption and pSetting Parameter Values

 

eOption

LMX_OPT_HEARTBEAT_CHECKOUT_SUCCESS_FUNCTION
This flag causes a callback function to be called when the heartbeat (per feature) has the status LMX_SUCCESS; that is, a heartbeat succeeds in reclaiming a license after a license server disconnection.

pSetting

Function pointer value.Default value:NULL (disabled)Prototype:void (LMX_CALLBACK *HeartbeatCheckoutSuccess_pfn)(
void pVendorData, / Vendor-specified data /const char *szFeatureName, / Name of feature successfully reclaimed */int nUsedLicCount */ Number of licenses reclaimed, which is equal to the number originally checked out */);

 

eOption

LMX_OPT_HEARTBEAT_CHECKOUT_FAILURE_FUNCTION
This flag causes a callback function to be called when the heartbeat (per feature) has a status different than LMX_SUCCESS; that is, if a heartbeat fails to reclaim a license after a license server reconnection.
If this function is called, the licenses for the given feature are considered lost.

pSetting

Function pointer value.
Default value:
NULL (disabled)
Prototype:
void (LMX_CALLBACK *HeartbeatCheckoutFailure_pfn)
(
void pVendorData, / Vendor-specified data */
const char szFeatureName, / Name of lost feature */
int nUsedLicCount, /* Number of licenses lost */
LMX_STATUS LmxStat /* Error code that indicates why they were lost */
);

 

eOption

LMX_OPT_HEARTBEAT_RETRY_FEATURE_FUNCTION
This flag causes a callback function to be called whenever there is an attempt to re-checkout a feature from a working server.
After this callback function is called, it is expected that the status for the feature will be given by calling either:
LMX_OPT_HEARTBEAT_CHECKOUT_SUCCESS_FUNCTION
or
LMX_OPT_HEARTBEAT_CHECKOUT_FAILURE_FUNCTION

pSetting

Function pointer value.Default value: NULL (disabled)Prototype:void (LMX_CALLBACK *HeartbeatRetryFeature_pfn)(
void pVendorData, / Vendor-specified data /const char *szFeatureName, / Name of feature about to be checked out /int nUsedLicCount / Number of licenses to checkout */);

 

eOption

LMX_OPT_HEARTBEAT_CONNECTION_LOST_FUNCTION
This flag causes a callback function to be called each time the connection to the license server is lost and heartbeats are failing. When this is called, all features are considered lost temporarily or permanently, depending on the results of the LMX_OPT_HEARTBEAT_CHECKOUT_SUCCESS_FUNCTION and LMX_OPT_HEARTBEAT_CHECKOUT_FAILURE_FUNCTION callbacks.
The parameter nFailedHeartbeats starts at 1 and goes up to the number of heartbeat attempts specified by LMX_OPT_AUTOMATIC_HEARTBEAT_ATTEMPTS. This parameter is per server.

pSetting

Function pointer value.
Default value:
NULL (disabled)
Prototype:
void (LMX_CALLBACK *HeartbeatConnectionLost_pfn)
(
void pVendorData, / Vendor-specified data */
const char szHost, / NULL-terminated string containing license server host */
int nPort, /* TCP port number of license server */
int nFailedHeartbeats /* The number of times a heartbeat has failed per server*/
);

 

eOption

LMX_OPT_HEARTBEAT_EXIT_FUNCTION
This flag causes a callback function to be called when automatic heartbeats cease attempts to reconnect to the license server. When this happens, the heartbeat thread is stopped, and no more heartbeats are called, but the application will continue to run.
If this flag is not set and automatic heartbeats cease attempts to reconnect to the license server, the heartbeat thread is stopped, and the client prints the message, "Lost license(s)! Unable to reconnect to license server!" to stderr, and calls exit(1). This causes the application to quit with return code 1 (see Return codes).

pSetting

Function pointer value.
Default value:
NULL (disabled)
Prototype:
void (LMX_CALLBACK *HeartbeatExit_pfn)
(
void pVendorData, / Vendor-specified data */
);

 

eOption

LMX_OPT_HEARTBEAT_CALLBACK_VENDORDATA
This flag lets you set a void pointer that will be supplied to the heartbeat callbacks. This allows you to pass custom information to the heartbeat callbacks.

pSetting

Void pointer value.
Default value:
NULL

 

eOption

LMX_OPT_CUSTOM_HOSTID_FUNCTION
This flag causes a callback function to be called if using the HostID functions LMX_Hostid() and LMX_HostidSimple() with parameter LMX_HOSTID_CUSTOM. This callback function is also called during checkouts when the license includes one or more custom HostIDs, regardless of whether a local license or a license server is being used.

pSetting

Function pointer value.
Default value:
NULL (disabled)
Prototype:
LMX_STATUS (LMX_CALLBACK *CustomHostidCallBack_pfn)
(
LMX_HOSTID *pHostid,
int *npHostids
);
See LMX_Hostid for information on using this callback function.

 

eOption

LMX_OPT_HOSTID_COMPARE_FUNCTION
This flag causes a callback function to be called to override the existing compare to verify whether a server HostID or client HostID is valid.

pSetting

Function pointer value.
Default value:
NULL (disabled)
Prototype:
LMX_STATUS (LMX_CALLBACK *HostidCompareCallBack_pfn)
(
LMX_KEY_HOSTID_TYPE eKeyHostidType, /* LMX_CLIENT_HOSTID or LMX_SERVER_HOSTID expected */
const LMX_HOSTID pLicenseHostid[],
int nLicenseHostids,
const LMX_HOSTID pSystemHostid[],
int nSystemHostids
);
See Custom HostID compare for information on using this callback function.

 

eOption

LMX_OPT_LICENSE_PATH
This flag sets the predefined license path, which is the default path the client application searches through to find a license. See the section "How a protected application finds its license" in the LM-X End Users Guide at {+}http://docs.x-formation.com/display/LMX/How+a+protected+application+finds+its+license+ for complete information about the license format, as well as the format of the environment variables users can set to specify a license file path.

pSetting

NULL-terminated string.
Default value:
NULL (disabled)

 

eOption

LMX_OPT_LICENSE_STRING
This flag sets a predefined license in a string. Passing a license through a string enables you to eliminate the requirement of external license files. A checkout attempt will be done on this string prior to any other license paths being used.
Using this option lets you ship your application without any external license files required.

pSetting

NULL-terminated string.
Default value:
NULL (disabled)

 

eOption

LMX_OPT_EXACT_VERSION
When this flag is enabled, the feature version specified in the license must exactly match the requested version in the checkout call.
When this flag is disabled, features can be checked out if their version is equal to or less than the version specified in the license.
With this flag disabled, you can provide licenses that will be "future proof" up to a certain feature version.
For example, say you are currently shipping version 1.3 of your software, but will soon ship version 1.5, and want to offer your customers an update promotion that lets them buy the current version now and receive version 1.5 for free when it ships.
To do this, you would set the feature version to 1.5 in the provided license, which will then work with both the current version and with version 1.5 once it is released, but will not work with any versions later than 1.5.
If this flag is enabled, however, the license will work only with the specified feature version.

pSetting

Possible values:
An integer, as follows:
0 (disabled) 1 (enabled)
Default value:
0 (disabled)

 

eOption

LMX_OPT_ALLOW_BORROW
When this flag is enabled, license borrowing is allowed on the client side.
When this flag is disabled, the client will reject any borrowing or borrowed licenses.
See BORROW for more information about using borrow licenses.

pSetting

Possible values:
An integer, as follows:
0 (disabled) 1 (enabled)
Default value:
1 (enabled)

 

eOption

LMX_OPT_ALLOW_GRACE
When this flag is enabled, grace licenses are allowed on the client side.
When this flag is disabled, the client will reject loading any grace licenses, even if they are enabled at the license server side.
See GRACE for more information about using grace licenses.

pSetting

Possible values:
An integer, as follows:
0 (disabled) 1 (enabled)
Default value:
1 (enabled)

 

eOption

LMX_OPT_TRIAL_DAYS
This flag specifies the number of days a trial license will be available in the event that no other license is found. You may use this in combination with LMX_OPT_TRIAL_USES (see below) if desired. If both options are used, the trial will expire based on whichever limit occurs first.
See Trial licenses for more information about using trial licenses.

pSetting

Possible values:
An integer, as follows:
0 (disabled—trial licenses are not available)1 - 60 (number of days a trial license will be available)
Default value:
0 (disabled)

 

eOption

LMX_OPT_TRIAL_USES
This flag specifies the number of uses allowed for a trial license. You may use this in combination with LMX_OPT_TRIAL DAYS (see above) if desired. If both options are used, the trial will expire based on whichever limit occurs first.
See Trial licenses for more information about using trial licenses.

pSetting

Possible values:
An integer, as follows:
-1 (disabled)1 - unlimited (number of times a trial license may be checked out)
Default value:
-1 (disabled)

 

eOption

LMX_OPT_TRIAL_VIRTUAL_MACHINE
This flag lets you control whether trial licenses are allowed to work on virtual machines.

pSetting

Possible values:
An integer, as follows:
0 (disallow) 1 (allow)
Default value:
0 (disallowed)

 

eOption

LMX_OPT_TRIAL_TERMINAL_SERVER
This flag lets you control whether trial licenses are allowed to work on terminal servers.

pSetting

Possible values:
An integer, as follows:
0 (disallow) 1 (allow)
Default value:
0 (disallowed)

 

eOption

LMX_OPT_AUTOMATIC_HEARTBEAT_ATTEMPTS
This flag specifies whether automatic heartbeats are enabled and the maximum number of failed heartbeat attempts before LM-X shuts down the application.
When this option is enabled and network licensing is used, a separate thread is started that performs automatic heartbeats once every 2 minutes. This interval can be changed using LMX_OPT_AUTOMATIC_HEARTBEAT_INTERVAL, described below.

pSetting

Possible values:
An integer, as follows:
-1 (Ignore failed heartbeat attempts. With this setting, your application will not shut down even if the license server goes down infinitely after a checkout. This setting is useful for a lenient license model. New instances of your application will not be able to start, but existing sessions will continue to run.)
0 (Disabled. The client should perform manual heartbeats instead using LMX_Heartbeat() to keep the license. See LMX_Heartbeat for information about the LMX_Heartbeat function.)
>0 (Shut down the application if no heartbeat response is received after the specified number of consecutive attempts. Once a valid heartbeat response is received, the internal counter will reset.)
Default value:
0 (disabled)

 

eOption

LMX_OPT_AUTOMATIC_HEARTBEAT_INTERVAL
This flag specifies the time in seconds between each automatic heartbeat performed.
This option is used only when automatic heartbeats are enabled.
Note that changes to this option might require that you adjust the client timeout on the license server accordingly to prevent your application timing out from the server.

pSetting

Possible values:
An integer, as follows:
30 - 900 (seconds)
Default value:
120 (seconds)

 

eOption

LMX_OPT_CUSTOM_SHARE_STRING
This flag enables a custom sharing string that is used when custom sharing is enabled in the license. Processes that use the same share string will share the same license unless the HOST and/or USER options are set and the processes have different hosts and/or users. Processes using different share strings will not share licenses.

pSetting

NULL-terminated string.
Default value:
NULL (Custom sharing not enabled)

 

eOption

LMX_OPT_SERVERSIDE_REQUEST_STRING
This flag sets a custom string that is sent to the server as a part of the checkout (see LMX_Checkout) or checkin (see LMX_Checkin) request. The set string will be available from the LMX_SERVERSIDE_REQUEST structure as a callback on the license server.

pSetting

NULL-terminated string.
Default value:
NULL (disabled)


eOption

LMX_OPT_LICENSE_IDLE
This flag specifies whether license idling is enabled. When enabled, no heartbeats are sent to the license server, resulting in the license server releasing the licenses after 5 minutes (configurable as described in License server).

pSetting

Possible values:
An integer, as follows:
0 (disabled) 1 (enabled)
Default value:
0 (disabled)

 

eOption

LMX_OPT_CUSTOM_USERNAME
This flag sets a username that overrides the username sent to the license server during checkout.
For more information, see Specifying username and hostname for checkouts.

pSetting

NULL-terminated string.
Default value:
NULL (disabled)

 

eOption

LMX_OPT_CUSTOM_HOSTNAME
This flag sets a hostname that overrides the hostname sent to the license server during checkout.
For more information, see Specifying username and hostname for checkouts.

pSetting

NULL-terminated string.
Default value:
NULL (disabled)

 

eOption

LMX_OPT_BLACKLIST
This flag lets you enable blacklisting of the license. Blacklisting works with local, network and borrow licenses.
When a local license is blacklisted, attempts to checkout a license will result in the error message "Feature is blacklisted." When a network license is blacklisted, attempts to checkout a license will be treated as if the license does not exist. Blacklisting of a network license must be done on a license server machine.
Blacklisting applies to a unique feature in the license file, based on the unique KEY value of the feature. If this flag is set for a feature that is currently checked out, when the feature is checked back in it will become blacklisted. When replacing a blacklisted license file with a newly generated license file, the feature will be available for checkout again.

pSetting

Possible values:
An integer, as follows:
0 (disabled) 1 (enabled)
Default value:
0 (disabled)

 

eOption

LMX_OPT_ALLOW_MULTIPLE_SERVERS
This flag lets you switch between using one server or using multiple servers simultaneously during checkout. If this flag is enabled, each feature can be checked out from a separate server.

pSetting

Possible values:
An integer, as follows:
0 (disabled) 1 (enabled)
Default value:
1 (enabled)

 

eOption

LMX_OPT_HOSTID_CACHE_CLEANUP_INTERVAL
This flag lets you change the HostID cache interval (in seconds).
By default, HostIDs are cached the first time during checkout requests.
By setting this flag, you can avoid devices being used as HostIDs because they were cached. For example, a user could make a checkout using a dongle, then move the dongle to another computer and use it again while the dongle HostID is cached.
Use caution if changing this setting. An interval that is too low can decrease performance by creating too many checks. Conversely, an interval that is too high (or disabled) can compromise security. When this flag is disabled, no cache cleanup occurs.

pSetting

Possible values:
An integer, as follows:
0 (disabled) >0 (seconds)
Default value:
120 (seconds)

 

eOption

LMX_OPT_RESERVATION_TOKEN
This flag sets a reservation token that can be used together with LMX_Checkout to consume a reservation that was made for a particular feature and token.

pSetting

NULL-terminated string.
Default value:
NULL (disabled)

 

eOption

LMX_OPT_BIND_ADDRESS
This flag lets you limit which networks the client can connect to. When this flag is set, the client can use only the specified IP address to connect to a network.
You can set either an IPV4 address (for example, 192.168.0.2) or IPV6 address (for example, 1:2:3:4::1) that represents the local IP address you want to communicate through.
When this flag is not set, the client can connect to any available network.

pSetting

NULL-terminated string.
Default value:
NULL (disabled)

 

eOption

LMX_OPT_HOSTID_ENABLED
This flag specifies a particular HostID type to use during checkout.
When this flag is set, only the specified HostID will be used during checkout. You should ensure that the HostID specified is a HostID type that is used by the client.
By default all HostID types are enabled, so to use this setting, you must first set the option LMX_OPT_HOSTID_DISABLED using LMX_HOSTID_ALL HostID as the HostID type. This will disable all HostIDs so that only the HostID specified in LMX_OPT_HOSTID_ENABLED will be used.

pSetting

Enum value of type LMX_HOSTID_TYPE.
Default value:
LMX_HOSTID_ALL

 

eOption

LMX_OPT_HOSTID_DISABLED
This flag specifies a particular HostID type to remove during checkout.
When this flag is set, the specified HostID type is not used during checkout, which can improve performance.
Setting this flag to LMX_HOSTID_ALL will disable all HostID types, so that you can set a specific HostID type using LMX_OPT_HOSTID_ENABLED.

pSetting

Enum value of type LMX_HOSTID_TYPE.
Default value:
None. By default, all HostID types are enabled.

 

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

Note that some of the flags are used in combination with checkout requests. This enables you to set flags for single checkout requests if needed.
For example:
/* First checkout request requires an exact version match to pass */
LMX_SetOption(..., LMX_OPT_EXACT_VERSION, (LMX_OPTION) 1);
LMX_Checkout(...);
/* Second checkout request does not require an exact version match to pass
  but can have a higher version in license file than function request */
LMX_SetOption(..., LMX_OPT_EXACT_VERSION, (LMX_OPTION) 0);
LMX_Checkout(...);

  • No labels