beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 173

background image

i.LON SmartServer 2.0 Programming Tools User’s Guide

159

Note: Pointers to strings will not be NULL if they are not used, instead some may point to empty
strings.

6. Based on the results of the license key evaluation, validate the FPM license, or log a license error.

You can use a value other than 1 and later check for that specific value instead of using a boolean
zero/non-zero check. For example:

FPM_IS_LICENSED = SOME_MAGIC_NUMBER;

}

else

{

taskCallBlock.pGeneric

=

(void*)"FPM HVAC license key is invalid\n”;

LICMGR_TaskCall_LogLicenseError(&taskCallBlock);

}

7. If the SmartServer did not pass the Node Lock Check, log a

license error. For example:

}else

{

taskCallBlock.pGeneric

=

(void*)"FPM HVAC license invalid or not
found\n";

LICMGR_TaskCall_LogLicenseError(&taskCallBlock);

}

8. Free any license data stored in memory. For example:

LICMGR_TaskCall_FreeLicenseData(&taskCallBlock);
}

The following code demonstrates the license key of an FPM application license file being checked by
the license validation algorithm:

//Check if i.LON passed Node Lock Check

if (taskCallBlock.sts == LicMgrStsOK)

{

//store the license data

pLic

=

taskCallBlock.pLicense;

// Copy the key in parts

memcpy(secretKey, FPM_KEY_PART_0, sizeof(FPM_KEY_PART_0));

memcpy(&secretKey[sizeof(FPM_KEY_PART_0)],

FPM_KEY_PART_1,

sizeof(FPM_KEY_PART_1));

//call

security

algorithm

LICMGR_hmac_md5((unsigned

char*)pLic->szHashText,

strlen(pLic->szHashText),
secretKey,

16,

digest);

//compare

license

keys

if ((pLic->licenseKeyLen == MD5_DIGEST_LEN) &&

(memcmp(pLic->licenseKey, digest, MD5_DIGEST_LEN) == 0))

{

FPM_IS_LICENSED

=

SOME_NON_ZERO_VALUE;

printf("***FPM

license

validated***\n");

}

else

{