Step 3: creating the license validation routine, Create a license validation routine – Echelon i.LON SmartServer 2.0 User Manual

Page 168

Advertising
background image

154

Creating FPM Application Licenses

2. Insert code similar to the following somewhere after the FPM constructor:

// flag defining whether FPM license has been validated

static int FPM_IS_LICENSED; // initialized at run-time

// flag indicating whether FPM license has been checked

static bool FPM_CHECKED = FALSE;

// secret key for MD5/HMAC-MD5 algorithms

static unsigned char FPM_KEY_PART_1[MD5_DIGEST_LEN] =

{0x<hex>,0x<hex>,0x<hex>,0x<hex>,0x<hex>,0x<hex>,0x<hex>,0x<hex>,

0x<hex>,0x<hex>,0x<hex>,0x<hex>,0x<hex>,0x<hex>,0x<hex>,0x<hex>};

Tip: You could alternatively split the secret key into several pieces and put them back together in your
validation algorithm. You could also put the key definition (or some of its pieces) inside your validation
routine as a local variable. If a status variable is only accessed in a single routine but it needs to retain its
value outside the routine, it may be placed inside the routine as a static local variable.

Step 3: Creating the License Validation Routine

After you declare the static variables, you need to create a license validation routine. You first need to
add your routine in the header file (.h extension) of your application. You can then place your license
validation routine anywhere in your FPM application after the static variables you declared in step 2.

To create your license validation routine, you do the following:

1. Click the tab for the header file view.

2. Locate the Implements the user functionality section in the header file, and then

insert the following code under the public: declarations.

void <FPM license validation routine name>();

Advertising