xref: /titanic_44/usr/src/lib/libbc/inc/include/netdb.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1980,1983,1988 Regents of the University of California.
3*7c478bd9Sstevel@tonic-gate  * All rights reserved.
4*7c478bd9Sstevel@tonic-gate  *
5*7c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms are permitted
6*7c478bd9Sstevel@tonic-gate  * provided that this notice is preserved and that due credit is given
7*7c478bd9Sstevel@tonic-gate  * to the University of California at Berkeley. The name of the University
8*7c478bd9Sstevel@tonic-gate  * may not be used to endorse or promote products derived from this
9*7c478bd9Sstevel@tonic-gate  * software without specific prior written permission. This software
10*7c478bd9Sstevel@tonic-gate  * is provided ``as is'' without express or implied warranty.
11*7c478bd9Sstevel@tonic-gate  */
12*7c478bd9Sstevel@tonic-gate 
13*7c478bd9Sstevel@tonic-gate /*
14*7c478bd9Sstevel@tonic-gate  * Structures returned by network data base library.
15*7c478bd9Sstevel@tonic-gate  * All addresses are supplied in host order, and
16*7c478bd9Sstevel@tonic-gate  * returned in network order (suitable for use in system calls).
17*7c478bd9Sstevel@tonic-gate  */
18*7c478bd9Sstevel@tonic-gate 
19*7c478bd9Sstevel@tonic-gate #ifndef _netdb_h
20*7c478bd9Sstevel@tonic-gate #define _netdb_h
21*7c478bd9Sstevel@tonic-gate 
22*7c478bd9Sstevel@tonic-gate /*	from UCB 5.9 4/5/88	*/
23*7c478bd9Sstevel@tonic-gate 
24*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate #define _PATH_HEQUIV	"/etc/hosts.equiv"
27*7c478bd9Sstevel@tonic-gate #define _PATH_HOSTS	"/etc/hosts"
28*7c478bd9Sstevel@tonic-gate #define _PATH_NETWORKS	"/etc/networks"
29*7c478bd9Sstevel@tonic-gate #define _PATH_PROTOCOLS	"/etc/protocols"
30*7c478bd9Sstevel@tonic-gate #define _PATH_SERVICES	"/etc/services"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate struct	hostent {
33*7c478bd9Sstevel@tonic-gate 	char	*h_name;	/* official name of host */
34*7c478bd9Sstevel@tonic-gate 	char	**h_aliases;	/* alias list */
35*7c478bd9Sstevel@tonic-gate 	int	h_addrtype;	/* host address type */
36*7c478bd9Sstevel@tonic-gate 	int	h_length;	/* length of address */
37*7c478bd9Sstevel@tonic-gate 	char	**h_addr_list;	/* list of addresses from name server */
38*7c478bd9Sstevel@tonic-gate #define	h_addr	h_addr_list[0]	/* address, for backward compatiblity */
39*7c478bd9Sstevel@tonic-gate };
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate /*
42*7c478bd9Sstevel@tonic-gate  * Assumption here is that a network number
43*7c478bd9Sstevel@tonic-gate  * fits in 32 bits -- probably a poor one.
44*7c478bd9Sstevel@tonic-gate  */
45*7c478bd9Sstevel@tonic-gate struct	netent {
46*7c478bd9Sstevel@tonic-gate 	char		*n_name;	/* official name of net */
47*7c478bd9Sstevel@tonic-gate 	char		**n_aliases;	/* alias list */
48*7c478bd9Sstevel@tonic-gate 	int		n_addrtype;	/* net address type */
49*7c478bd9Sstevel@tonic-gate 	unsigned long	n_net;		/* network # */
50*7c478bd9Sstevel@tonic-gate };
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate struct	servent {
53*7c478bd9Sstevel@tonic-gate 	char	*s_name;	/* official service name */
54*7c478bd9Sstevel@tonic-gate 	char	**s_aliases;	/* alias list */
55*7c478bd9Sstevel@tonic-gate 	int	s_port;		/* port # */
56*7c478bd9Sstevel@tonic-gate 	char	*s_proto;	/* protocol to use */
57*7c478bd9Sstevel@tonic-gate };
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate struct	protoent {
60*7c478bd9Sstevel@tonic-gate 	char	*p_name;	/* official protocol name */
61*7c478bd9Sstevel@tonic-gate 	char	**p_aliases;	/* alias list */
62*7c478bd9Sstevel@tonic-gate 	int	p_proto;	/* protocol # */
63*7c478bd9Sstevel@tonic-gate };
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate struct rpcent {
66*7c478bd9Sstevel@tonic-gate 	char	*r_name;	/* name of server for this rpc program */
67*7c478bd9Sstevel@tonic-gate 	char	**r_aliases;	/* alias list */
68*7c478bd9Sstevel@tonic-gate 	int	r_number;	/* rpc program number */
69*7c478bd9Sstevel@tonic-gate };
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate struct hostent	*gethostbyname(), *gethostbyaddr(), *gethostent();
72*7c478bd9Sstevel@tonic-gate struct netent	*getnetbyname(), *getnetbyaddr(), *getnetent();
73*7c478bd9Sstevel@tonic-gate struct servent	*getservbyname(), *getservbyport(), *getservent();
74*7c478bd9Sstevel@tonic-gate struct protoent	*getprotobyname(), *getprotobynumber(), *getprotoent();
75*7c478bd9Sstevel@tonic-gate struct rpcent	*getrpcbyname(), *getrpcbynumber(), *getrpcent();
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate /*
78*7c478bd9Sstevel@tonic-gate  * Error return codes from gethostbyname() and gethostbyaddr()
79*7c478bd9Sstevel@tonic-gate  * (when using the resolver)
80*7c478bd9Sstevel@tonic-gate  */
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate extern  int h_errno;
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate #define	HOST_NOT_FOUND	1 /* Authoritive Answer Host not found */
85*7c478bd9Sstevel@tonic-gate #define	TRY_AGAIN	2 /* Non-Authoritive Host not found, or SERVERFAIL */
86*7c478bd9Sstevel@tonic-gate #define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
87*7c478bd9Sstevel@tonic-gate #define	NO_DATA		4 /* Valid name, no data record of requested type */
88*7c478bd9Sstevel@tonic-gate #define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate #define MAXALIASES	35
91*7c478bd9Sstevel@tonic-gate #define MAXADDRS	35
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate #endif /*!_netdb_h*/
94