ph_serverlist_add(3)

NAME
ph_serverlist_add, ph_serverlist_merge, ph_serverlist_iterate, ph_free_serverlist - access list of known PH servers at other sites

SYNOPSIS
#include <phclient.h>

int ph_serverlist_add(struct ph_serverlist *serverlist, char *server, char *site);
int ph_serverlist_merge(PH *ph, struct ph_serverlist *serverlist);
int ph_serverlist_iterate(struct ph_serverlist *serverlist, char *server, char *site, struct ph_serversite **serversite);
void ph_free_serverlist(struct ph_serverlist *serverlist);

VERSION
This man page documents version 1.2 of libphclient.

DESCRIPTION
The ph_serverlist_add() function will add an entry for the PH server server at site site to the list of servers in serverlist. The ph_serverlist_merge() function will read the list of known PH servers from the server associated with ph and add any previously- unknown entries to the list of servers in serverlist. The ph_serverlist_iterate() function allows the caller to cycle through the list of known PH servers by setting serversite to point to the next matching entry in serverlist on each successive call. To start at the beginning of the list, the caller initializes serversite to NULL. If server is not NULL, only entries whose last two or more domain name componants of the server field match the server argument will be returned. If site is not NULL, only entries whose site field contain the argument site as a substring will be returned. If both server and site are non-NULL, only entries matching both criteria will be returned. If both server and site are NULL, all entries are returned. The ph_free_serverlist() function frees memory associated with the PH server list serverlist.

RETURN VALUE
The ph_serverlist_add() function returns 0 on success, or -1 on error (and set errno). The ph_serverlist_merge() function returns 0 on success, PH_ERR_DATAERR if the server does not understand the query, or -1 on error (and set errno). The ph_serverlist_iterate() function returns 1 when a matching entry is returned, 0 when no more matching entries have been found, or -1 on error (and sets errno).

ERRORS
The ph_serverlist_merge() function will fail with EINVAL if it receives an unexpected response code from the server. The ph_serverlist_iterate() function will fail with EINVAL if the server argument is non-NULL but specifies an illegal domain name.

SEE ALSO
read(2), write(2), ph_open(3), ph_query(3)