/*
 * Really Simple Threads package.  Copyright Robert S. Thau 1996.
 * This code may be used for any purpose.  It may be redistributed on
 * the following terms: 1) this paragraph and the next must appear
 * unaltered in any source distribution, and be prominently displayed
 * in the supporting documentation for any source or binary
 * distribution; 2) if you wish to distribute modified or derived
 * works, each such work must bear a notice of who last altered the
 * included version of Really Simple Threads, and when.  The notice of
 * alterations shall be attached to the derivative works in the same
 * manner as these two paragraphs, and shall be at least as prominent.
 * Redistribution for any purpose is otherwise unrestricted.
 *
 * THIS CODE IS IN AN UNFINISHED STATE, AND HAS NOT BEEN TESTED
 * TO THE POINT THAT THE AUTHOR BELIEVES IT CAN BE EXPECTED TO
 * WORK RELIABLY.  IT IS SUITABLE, AT THIS POINT, FOR EXPERIMENTATION
 * AND DEBUGGING ONLY.  TREAT ACCORDINGLY.
 */

#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>

/****************************************************************
 *
 * Host name from address.  Returns 1 on success, 0 if it
 * couldn't find anything, and -1 if things *really* went south.
 * If time_to_live is not NULL, the long that it points to is set
 * to the time-to-live of this information, according to the DNS
 * server.
 */

int rst_gethostname (struct in_addr *addr, char *namebuf, int buflen,
		     unsigned long *time_to_live);

/*****************************************************************
 *
 * Get host address(es), given the name.  Can return
 * multiple addresses (num_addr arg is the number that the caller is
 * prepared to accept).  Returns the number of addresses, found,
 * or 0 or -1 as above.  Likewise, time_to_live argument is as above.
 * (In the case that multiple addresses are found, it is set to the
 * TTL of the one with the *least* time-to-live).
 *
 * Note that this routine accepts full hostnames only.  It does *not*
 * implement the usual conventions that at, say,
 *
 *   fine-ground.walnut.chopped-nuts.org
 *
 * a request for host 'coarse' should find coarse.walnut.chopped-nuts.org
 * or coarse.chopped-nuts.org if those exist.
 */

int rst_gethostaddrs (char *hostname, struct in_addr *addrs, int num_addrs,
		      unsigned long *time_to_live);

/****************************************************************
 *
 * libc lookalike interfaces...
 */

struct hostent *rst_gethostbyname (char *);
struct hostent *rst_gethostbyaddr (char *addr, int len, int fmt);

