Appendix B. FLEXlm 3.0 API Compatibility Macros

FLEXlm v4.0 has a completely new API, where every function uses a job handle. In the new API, all the lm_xxx() functions are replaced by lc_xxx() functions. Each lc_xxx() function is identical to the pre 4.0 lm_xxx() function with the addition of a job handle pointer as its first parameter. So, for example, lm_checkin() was called as:

lm_checkin(feature, keep_connection)

so, lc_checkin is:

lc_checkin(job, feature, keep_connection)

In this call “job” is a (LM_HANDLE *).

The lc_ prefix stands for “license client function”, while the ls_, used for functions in liblmgr_s.a, stands for “license server function”.

The old API has been preserved with a set of macros in lm_client.h; however, if you want to use the old API, you will need to make the following code changes:

LM_A_CUR_JOB removed

With the new API, each lc_xxx function takes the job handle as a first argument, so there is effectively no “current job.” If you are using the LM_DATA macro and lm_xxx functions, then you can change “current jobs” by simply setting lm_job to the current job handle, since, all the lc_xxx functions get lm_job as the job handle.

VENDOR_KEY5 and the LM_CODE macro

FLEXlm v4.0 added a fifth vendor key to increase the security of your binaries. This key is XORd (“^”) into your two encryption seeds, so that your encryption seeds never appear anywhere in your program or vendor daemon. This fifth vendor key, also, never appears in your application code. The only place they occur is in calls to the new lc_crypt function, which should only be used to generate license files.

lc_checkout() version is now a string

The version argument to lc_checkout() has been changed from a double floating point number to a string. FLEXlm requires that the string be a valid floating point number, so the only change that has occurred is that double-quotes (“) must be added around the version argument.

Example, before FLEXlm v4.0:

lm_checkout("f1", 1.0, 1, LM_CO_WAIT, &code, LM_DUP_NONE);

Current:

lc_checkout(job, "f1", "1.0", 1, LM_CO_WAIT, &code, LM_DUP_NONE);

In FLEXlm v4.0, there is no use of floating-point in the libraries, and all the alternate floating-point libraries have been removed from the kits.

LM_USERS struct changes

The LM_USERS struct previously contained three members that have been replaced. The old members were:

LM_SERVER *server;   /* License server */
LM_LICENSE_HANDLE license; /* License handle */
LM_FEATURE_HANDLE feature; /* feature handle */

The replacement members are:

CONFIG_PTR ul_conf;  /* CONFIG associated */
LM_LICENSE_HANDLE ul_license_handle; /* Server's license handle */

The new members provide a better description of the license that the user is using. Note the following equivalences:

old: server => new: ul_conf->server
old: license.handle => new: ul_license_handle
old: feature.code => new: ul_conf->code


Note: Old->feature.code was a char * — new->ul_conf->code is a char array.


l_crypt renamed to lc_crypt and args changed

Change any pre-4.0 references you have in your license generator from l_crypt() to lc_crypt(). This new name was made for additional security on Windows platforms, where DLLs are used. To take advantage of this security feature, never call lc_crypt() (or the new lc_cryptstr() function) in programs that are shipped to customers.

Before calling lc_crypt(), or lc_cryptstr(), you must add the following or similar code:

LM_CODE(code, ENCRYPTION_CODE_1, ENCRYPTION_CODE_2, VENDOR_KEY1,
VENDOR_KEY2, VENDOR_KEY3, VENDOR_KEY4, VENDOR_KEY5);
VENDORCODE vc;
[...]
(void) memcpy((char *)&vc, (char *)&code, sizeof(vc));
vc.data[0] ^= VENDOR_KEY5;
vc.data[1] ^= VENDOR_KEY5;
lc_crypt(lm_job, &conf, l_bin_date(0), &vc);