xref: /original-bsd/include/netdb.h (revision f91c1509)
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.14 (Berkeley) 03/02/91
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 /*
55  * Error return codes from gethostbyname() and gethostbyaddr()
56  * (left in extern int h_errno).
57  */
58 
59 #define	HOST_NOT_FOUND	1 /* Authoritative Answer Host not found */
60 #define	TRY_AGAIN	2 /* Non-Authoritive Host not found, or SERVERFAIL */
61 #define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
62 #define	NO_DATA		4 /* Valid name, no data record of requested type */
63 #define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
64 
65 #include <sys/cdefs.h>
66 
67 __BEGIN_DECLS
68 void		endhostent __P((void));
69 void		endnetent __P((void));
70 void		endprotoent __P((void));
71 void		endservent __P((void));
72 struct hostent	*gethostbyaddr __P((const char *, int, int));
73 struct hostent	*gethostbyname __P((char *));
74 struct hostent *gethostent __P((void));
75 struct netent	*getnetbyaddr __P((long, int)); /* u_long? */
76 struct netent	*getnetbyname __P((const char *));
77 struct netent	*getnetent __P((void));
78 struct protoent	*getprotobyname __P((const char *));
79 struct protoent	*getprotobynumber __P((int));
80 struct protoent	*getprotoent __P((void));
81 struct servent	*getservbyname __P((const char *, const char *));
82 struct servent	*getservbyport __P((int, const char *));
83 struct servent	*getservent __P((void));
84 void		herror __P((const char *));
85 void		sethostent __P((int));
86 /* void		sethostfile __P((const char *)); */
87 void		setnetent __P((int));
88 void		setprotoent __P((int));
89 void		setservent __P((int));
90 __END_DECLS
91