The handle is returned to the caller, and should be passed to the other functions.
For each call to krb5_krbhst_next information a new host is returned. The former function returns in host a pointer to a structure containing information about the host, such as protocol, hostname, and port:
typedef struct krb5_krbhst_info {
enum { KRB5_KRBHST_UDP,
KRB5_KRBHST_TCP,
KRB5_KRBHST_HTTP } proto;
unsigned short port;
struct addrinfo *ai;
struct krb5_krbhst_info *next;
char hostname[1];
} krb5_krbhst_info;
The related function, krb5_krbhst_next_as_string, return the same information as a url-like string.
When there are no more hosts, these functions return KRB5_KDC_UNREACH.
To re-iterate over all hosts, call krb5_krbhst_reset and the next call to krb5_krbhst_next will return the first host.
When done with the handle, krb5_krbhst_free should be called.
To use a krb5_krbhst_info, there are two functions: krb5_krbhst_format_string that will return a printable representation of that struct and krb5_krbhst_get_addrinfo that will return a struct addrinfo that can then be used for communicating with the server mentioned.