Versions Compared

Key

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

...

You should ensure that you complete the LMX_HOSTID structure correctly and return the appropriate error code, as shown in the following example.

Code Block
languagecpp
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.

...