To make use of custom HostIDs, you must set a callback function using LMX_SetOption with the flag LMX_OPT_CUSTOM_HOSTID_FUNCTION. See LMX_OPT_CUSTOM_HOSTID_FUNCTION in LMX_SetOption for more information.
You should ensure that you complete the LMX_HOSTID structure correctly and return the appropriate error code, as shown in the following example.
LMX_STATUS LMX_CALLBACK MyHostidCallback(LMX_HOSTID *pHostid, int *npHostids)
{
printf("My HostID called\n");
/* Set the length of the data of this HostID. */
/* Its length can be up to LMX_MAX_SHORT_STRING_LENGTH */
strcpy(pHostid[0].szValue, "abcd");
/* Set optional description. */
/* Its length can be up to LMX_MAX_SHORT_STRING_LENGTH */
strcpy(pHostid[0].szDescription, "my HostID");
/* Now we do it once more for a 2nd HostID. */
strcpy(pHostid[1].szValue, "12345");
strcpy(pHostid[1].szDescription, "my HostID2");
/* Set that we return 2 custom HostIDs. */
*npHostids = 2;
/* The function must return either LMX_SUCCESS or LMX_UNKNOWN_ERROR. */
return LMX_SUCCESS;
/* return LMX_UNKNOWN_ERROR; */
}
The same callback function is also required to use custom HostIDs on a license server. In lmxserverconf.c you can set the custom HostID callback function to create licenses that are locked to a license server with a custom HostID.
You can easily use multiple HostID sources for such a custom callback function. Either fill the array with the independent values or use a cryptographic hash function such as SHA-1 to combine the HostIDs into a single value.