/*
 	BONE resolver

	Copyright (C) 1999 Be Incorporated.  All Rights Reserved.

 */

#ifndef H_NETDB
#define H_NETDB

#ifdef __cplusplus
extern "C" {
#endif

#include <netinet/in.h>
#include <stdio.h>
#include <sys/param.h>
#include <sys/cdefs.h>
#include <sys/bitypes.h>

#define	_PATH_HOSTS	"/etc/hosts"
#define	_PATH_SERVICES	"/etc/services"
#define _PATH_RESCONF        "/etc/resolv.conf" 

#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif

struct hostent
{
	char		*h_name;	
	char		**h_aliases;	
	int			h_addrtype;
	int			h_length;	
	char		**h_addr_list;	
#define	h_addr	h_addr_list[0]	
};


struct servent
{
	char	*s_name;	
	char	**s_aliases;	
	int		s_port;		
	char	*s_proto;	
};


struct hostent	*gethostbyaddr(const char *addr, int len, int type);
struct hostent	*gethostbyname(const char *name);
struct hostent	*gethostbyname2(const char *name, int family);
struct servent	*getservbyname(const char *name, const char *proto);

int				gethostbyaddr_r(const char *addr, int len, int type, struct hostent *buf);
int				gethostbyname_r(const char *addr, struct hostent *buf);


#define HOST_NOT_FOUND	1
#define TRY_AGAIN		2
#define NO_RECOVERY		3
#define NO_DATA			4

void 			herror(const char *str);
const char 		*hstrerror(int herr);

extern int h_errno;

#ifdef __cplusplus
}
#endif

#endif /* H_NETDB */
