xref: /original-bsd/include/netdb.h (revision 1e82c8c9)
1 /*-
2  * Copyright (c) 1980, 1983, 1988 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)netdb.h	5.11 (Berkeley) 05/21/90
8  */
9 
10 #define	_PATH_HEQUIV	"/etc/hosts.equiv"
11 #define	_PATH_HOSTS	"/etc/hosts"
12 #define	_PATH_NETWORKS	"/etc/networks"
13 #define	_PATH_PROTOCOLS	"/etc/protocols"
14 #define	_PATH_SERVICES	"/etc/services"
15 
16 /*
17  * Structures returned by network data base library.  All addresses are
18  * supplied in host order, and returned in network order (suitable for
19  * use in system calls).
20  */
21 struct	hostent {
22 	char	*h_name;	/* official name of host */
23 	char	**h_aliases;	/* alias list */
24 	int	h_addrtype;	/* host address type */
25 	int	h_length;	/* length of address */
26 	char	**h_addr_list;	/* list of addresses from name server */
27 #define	h_addr	h_addr_list[0]	/* address, for backward compatiblity */
28 };
29 
30 /*
31  * Assumption here is that a network number
32  * fits in 32 bits -- probably a poor one.
33  */
34 struct	netent {
35 	char		*n_name;	/* official name of net */
36 	char		**n_aliases;	/* alias list */
37 	int		n_addrtype;	/* net address type */
38 	unsigned long	n_net;		/* network # */
39 };
40 
41 struct	servent {
42 	char	*s_name;	/* official service name */
43 	char	**s_aliases;	/* alias list */
44 	int	s_port;		/* port # */
45 	char	*s_proto;	/* protocol to use */
46 };
47 
48 struct	protoent {
49 	char	*p_name;	/* official protocol name */
50 	char	**p_aliases;	/* alias list */
51 	int	p_proto;	/* protocol # */
52 };
53 
54 struct hostent	*gethostbyname(), *gethostbyaddr(), *gethostent();
55 struct netent	*getnetbyname(), *getnetbyaddr(), *getnetent();
56 struct servent	*getservbyname(), *getservbyport(), *getservent();
57 struct protoent	*getprotobyname(), *getprotobynumber(), *getprotoent();
58 
59 /*
60  * Error return codes from gethostbyname() and gethostbyaddr()
61  * (left in extern int h_errno).
62  */
63 
64 #define	HOST_NOT_FOUND	1 /* Authoritative Answer Host not found */
65 #define	TRY_AGAIN	2 /* Non-Authoritive Host not found, or SERVERFAIL */
66 #define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
67 #define	NO_DATA		4 /* Valid name, no data record of requested type */
68 #define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
69