Versions Compared

Key

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

...

  1. Start a new project in your IDE. Base your code on the example in LM-X root directory\examples\local\local.c.

  2. Include the LM-X library into your application (see the LM-X Quick Start Guide for more information).

  3. Generate a node-locked license file using xmllicgengui (for Windows only; use xmlilicgen for other platforms), located in LM-X root directory\platform-specific directory, for example, C:\LM-X\Win32_x86.

  4. Using the OPTIONS setting, specify the custom parameter that the license will be limited to, in our example, "USERCOUNT=80" (you may use a different syntax such as "PARAM1=text1,text2,text3 PARAM2=value"). An example of the feature settings for this node-locked license are shown in the following screenshot.

    An example XML template for this node-locked license looks like the following:

    Code Block
    ‹?xml version="1.0" encoding="utf-8"?›
    ‹LICENSEFILE›
    ‹FEATURE NAME="MyFeatureName"›
    ‹SETTING MAJOR_VERSION="1" /›
    ‹SETTING MINOR_VERSION="0" /›
    ‹SETTING END="2012-01-01" /›
    ‹SETTING OPTIONS="USERCOUNT=80" /›
    ‹CLIENT_HOSTID›
    ‹SETTING ETHERNET="D71D90A3763DD3BF" /›
    ‹/CLIENT_HOSTID›
    ‹/FEATURE›
    ‹/LICENSEFILE›

    You may create multiple templates that use such a custom setting. For example, you might have a template called "Small Business" with USERCOUNT=80, another called "Corporate" with USERCOUNT=200, etc. When the end-user upgrades the license from Small Business to Corporate, all you need to do is ship a new license file. (Note that this example also includes additional security features: the HOSTID setting, which provides copy protection by allowing end-users to run the application on only one machine, and an expiration date.)

  5. In your code (based on the local.c example), access the license setting OPTIONS "USERCOUNT=80" using FI.szOptions, which is available after calling LMX_GetFeatureInfo(LmxHandle, LMX_GetFeatureChecksum("MyFeatureName")).

    Retrieve the integer from string FI.szOptions and compare it with the actual value in your application. If the comparison does not match your limitation, you can force the program to exit (remember to use LMX_Free(LmxHandle) upon exit to free allocated memory). Otherwise, license restrictions are fulfilled and you can continue. Repeat the comparison whenever your parameter may change.

  6. Compile and run your application to check how it works.
    The information about your custom parameter is encrypted in the license key and, by default, is visible in the license file. If you don't want the custom parameter displayed in the license file, use the KEYCOMMENT setting instead of the OPTIONS setting. 

...

  1. Start a new project in your IDE. Base your code on the example in LM-X root directory\examples\network\network.c.

  2. Include the LM-X library into your application (see the LM-X Quick Start Guide for more information).

  3. Generate a floating license file using xmllicgengui (for Windows only; use xmlilicgen for other platforms), located in LM-X root directory\platform-specific directory; for example, C:\LM-X\Win32_x86. The settings for the floating license are shown in the following screenshot:

    An example XML template for a floating license looks like the following:

    Code Block
    ‹?xml version="1.0" encoding="utf-8"?›
    ‹LICENSEFILE›
    ‹SETTING END="2012-01-01" /›
    ‹FEATURE NAME="MyFeatureName" /›
    ‹SETTING MAJOR_VERSION="1" /›
    ‹SETTING MINOR_VERSION="0" /›
    ‹SETTING COUNT="80" /›
    ‹SERVER_HOSTID›
    ‹SETTING ETHERNET="C8A516AD01AFC9FA" /›
    ‹/SERVER_HOSTID›
    ‹/FEATURE›
    ‹/LICENSEFILE›

    4. The following example assumes that your custom parameter in the application code is an integer called MyCustomParameter. To take the custom parameter into account in your code (based on network.c example), change the checkout parameter:

    LMX_Checkout(LmxHandle, LMX_GetFeatureChecksum( "MyFeatureName"), 1, 0, 1)

    to:

    LMX_Checkout(LmxHandle, LMX_GetFeatureChecksum( "MyFeatureName"), 1, 0, MyCustomParameter)

    This will take into account the initial value of the custom parameter. We can also assume the custom parameter might change during the program runtime. For this reason, we'll define a variable called MyCustomParameterDifference, which will be the difference between the previous and current value. Whenever the custom parameter changes, the MyCustomParameterDifference value must be updated and LMX_Checkout or LMX_Checkin called depending on the negative or positive change. If the difference is positive we'll call:

    LMX_Checkout(LmxHandle, LMX_GetFeatureChecksum( "MyFeatureName"), 1, 0, MyCustomParameterDifference)

    If the difference is negative we'll call:

    LMX_Checkin(LmxHandle, LMX_GetFeatureChecksum( "MyFeatureName"), ( (-1)*MyCustomParameterDifference) )

    5.Compile your application. To check how it works, remember to start the license server (refer to the LM-X Quick Start Guide for more information).

    In the example illustrated above, the protected application takes a number of licenses from the license pool according to a parameter within your application. During the application runtime, it can take more licenses or release licenses according to the parameter changes.

    Another licensing model where one application uses more than one license is token-based licensing. The primary use for token-based licensing is to let users purchase a number of features that each require one or more real licenses. This gives users a "pool" of licenses they can draw upon for license checkout requests, providing the flexibility to use various feature combinations as needed. 

...