Versions Compared

Key

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

...

To make use of custom HostIDs, you must set a callback function using LMX_SetOption with the flag LMX_OPT_CUSTOM_HOSTID_FUNCTION.

Example

You can use the following code to list HostIDs that are being used and retrieve information contained in LMX_HOSTID.

Code Block
languagecpp
#include <lmx.h>
#include <stdio.h>

LMX_HANDLE h;

int main() {
  LMX_HOSTID hostID[LMX_MAX_HOSTIDS];
  int nbHosts, i;

  exit_on_error(LMX_Init(&h));
  exit_on_error(LMX_Hostid(h, LMX_HOSTID_ALL, hostID, &nbHosts));
  printf("HostIDs found: %d\n", nbHosts);
  
  for(i = 0; i < nbHosts; ++i) {
    printf("Host Type: %d\n", hostID[i].eHostidType);
    printf("Description: %s\n", hostID[i].szDescription);
    printf("Value: %s\n\n", hostID[i].szValue);
  }

  return 0;
}