Knowledgebase Home | Favorites | Login Knowledgebase Home | Favorites | Login
Search the Knowledgebase Browse by Category or Article ID
Using a custom setting in a floating license
User Opinions (17 votes)
100% thumbs up 0% thumbs down

How would you rate this answer?
Helpful
Not helpful
Article ID: 200

Last Updated: 23rd August 2010 08:19:21 am

LM-X License Manager lets you specify custom settings in your license file, allowing for extensive flexibility and increased pricing depth for your software offerings. A custom setting lets you base license checkouts on certain factors that exist at the user site during run time. A custom setting may be the number of CPU's on the client's machine, currently monitored users, current connections, or similar factors. This license model enables you to tailor licensing to your target customers and characteristics of your software.

For example, say you want to offer a discounted small business license that allows a maximum of 80 concurrent users. This means the custom setting, which we'll call USERCOUNT, cannot exceed a value of 80.

To base floating licensing on the custom USERCOUNT setting (example made in Windows environment): 

  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:

    ‹?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.
Related Content
Related Articles
Attachments
No attachments were found.
All Content Copyright © 2002-2012 X-Formation. All Rights Reserved.